Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream #1

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

upstream #1

wants to merge 27 commits into from

Conversation

simonoff
Copy link
Member

@simonoff simonoff commented Dec 8, 2023

No description provided.

joshbranham and others added 27 commits October 19, 2022 01:45
* Update Travis configuration

* Drop os, use default

* Use focal for OS

* Restore patch versions of ruby, rvm not pulling latest patch

* Update local test/run.sh script for easier local testing

* Add some old AR back, remove 3+ rubies, drop deprecated codeclimate gem

* Lock sqlite3 for Ruby 2.5

* ActiveRecord 6.0 and 6.1 tests failing, add later

* Drop 2.5

* Update gemspec, pry for dev support

* 5.1.1 AR works, update test/run.sh

* Fix support for ActiveRecord 5.2
In Ruby 3.0, positional arguments and keyword arguments will be
separated. Ruby 2.7 will warn for behaviors that will change in Ruby
3.0.

Co-authored-by: Igor Drozdov <[email protected]>
Changed inccorectly -> incorrectly on line 412

Co-authored-by: Gabriel <[email protected]>
Co-authored-by: Alex Brinkman <[email protected]>
As those should be passing or otherwise dealt with by the
time this is merged
…r Rails >= 5.2

Use #write_cast_value instead of #set_attribute_was patch
… with Rails 7

Prefix 'attr_encrypted' to encrypt and decrypt methods to avoid clash with Rails 7

Adopted from PR: #425
This project has been dead since 2018
* Start testing ruby 3

* Exclude older AR and newer Ruby combos

* Add Ruby 3.0.6 as well

* Exclude 3.0.6 and AR 5.x
Rails 7.1 will deprecate using the singleton ActiveSupport::Deprecation
instance. This directly uses the one from ActiveRecord.

Co-authored-by: Josh Branham <[email protected]>
* Use Github Actions for CI

* Add back old Rails versions

* Only test Rails 5 on Ruby 2.7

---------

Co-authored-by: Josh Branham <[email protected]>
* Add Josh and Mike to authors

Signed-off-by: Josh Branham <[email protected]>

* Update attr_encrypted.gemspec

Signed-off-by: Josh Branham <[email protected]>

---------

Signed-off-by: Josh Branham <[email protected]>
* Update README.md

Signed-off-by: Josh Branham <[email protected]>

* Update README.md

Signed-off-by: Josh Branham <[email protected]>

---------

Signed-off-by: Josh Branham <[email protected]>
…pend (#457)

For example, when using the master branch of activerecord-multi-tenant, if activerecord-multi-tenant and attr_encrypted are listed in the Gemfile in that order, calling the reload method raises a SystemStackError. This happens because activerecord-multi-tenant extends Active Record’s reload method using prepend, while attr_encrypted extends it using an alias method.

Here’s an example of how extending the same method with both prepend and alias methods in that order can result in a SystemStackError

```
class Hello
  def hello
    'hello'
  end
end

Hello.prepend(Module.new do
  def hello
    super
  end
end)

Hello.class_eval do
  alias orig_hello hello

  def hello
    "#{orig_hello} world"
  end
end

Hello.new.hello #=> SystemStackError
```

However, reversing the order works:

```
class Hello
  def hello
    'hello'
  end
end

Hello.class_eval do
  alias orig_hello hello

  def hello
    "#{orig_hello} world"
  end
end

Hello.prepend(Module.new do
  def hello
    super
  end
end)

Hello.new.hello #=> "hello world"
```

This issue can be resolved by standardizing the method extension to use prepend to avoid conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants