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

Support of Rails 5.2 #13

Closed
OL-Mark opened this issue Apr 27, 2018 · 7 comments
Closed

Support of Rails 5.2 #13

OL-Mark opened this issue Apr 27, 2018 · 7 comments

Comments

@OL-Mark
Copy link

OL-Mark commented Apr 27, 2018

Hello,
I've updated my rails app and faced with issue:

[1] pry(main)> s = Session.new
=> #<Session:0x0000000a83eb68
 @attributes=
  {"id"=>nil,
   "user_id"=>nil,
   "user_roles"=>nil,
   "account_id"=>nil,
   "application_id"=>nil,
   "nonce"=>nil,
   "ts"=>nil,
   "token"=>nil,
   "updated_at"=>nil,
   "created_at"=>nil,
   "need_to_greet"=>false,
   "nonce_ts_hash"=>nil},
 @changed_attributes=nil>
[2] pry(main)> s.user_id = 111
NoMethodError: undefined method `changed?' for nil:NilClass
from /home/alex/.rvm/gems/ruby-2.3.3/gems/activemodel-5.2.0/lib/active_model/attribute_mutation_tracker.rb:45:in `changed?'
[3] pry(main)> 

###########################################
    42: def changed?(attr_name, from: OPTION_NOT_GIVEN, to: OPTION_NOT_GIVEN)
    43:   attr_name = attr_name.to_s
    44:   binding.pry
    45:   forced_changes.include?(attr_name) ||
    46:     attributes[attr_name].changed? &&
    47:     (OPTION_NOT_GIVEN == from || attributes[attr_name].original_value == from) &&
 => 48:     (OPTION_NOT_GIVEN == to || attributes[attr_name].value == to)
    49: end

[1] pry(#<ActiveModel::AttributeMutationTracker>)> attr_name
=> "user_id"
[2] pry(#<ActiveModel::AttributeMutationTracker>)> attributes[attr_name].inspect
=> "nil"
###########################################
And same for my User model which uses ActiveRecord:

    42: def changed?(attr_name, from: OPTION_NOT_GIVEN, to: OPTION_NOT_GIVEN)
    43:   attr_name = attr_name.to_s
    44:   binding.pry
    45:   forced_changes.include?(attr_name) ||
    46:     attributes[attr_name].changed? &&
    47:     (OPTION_NOT_GIVEN == from || attributes[attr_name].original_value == from) &&
 => 48:     (OPTION_NOT_GIVEN == to || attributes[attr_name].value == to)
    49: end

[1] pry(#<ActiveModel::AttributeMutationTracker>)> attr_name
=> "id"
[2] pry(#<ActiveModel::AttributeMutationTracker>)> attributes[attr_name]
=> #<ActiveModel::Attribute::FromDatabase:0x0000000849dc18
 @name="id",
 @original_attribute=nil,
 @type=#<ActiveModel::Type::Integer:0x00000008b6b158 @limit=4, @precision=nil, @range=-2147483648...2147483648, @scale=nil>,
 @value=nil,
 @value_before_type_cast=nil>
[3] pry(#<ActiveModel::AttributeMutationTracker>)> 

Do you have plans to support Rails 5.2? And when can we expect a new release?
Thanks :)

@soulfly
Copy link

soulfly commented May 2, 2018

@Tonkpils could you please provide your feedback here?

@Tonkpils
Copy link
Collaborator

Tonkpils commented May 2, 2018

Unfortunately, I'm not using this gem on a consistent basis to know what the actual issue may be.

I'd be happy to review and merge a PR that brings compatibility of this gem to Rails 5.2. If I have some free cycles I could get to tackling this but I'm not sure when that will be.

@soulfly
Copy link

soulfly commented May 2, 2018

@Tonkpils thanks for you reply

@ileitch are you still an active contributor? Could you please guide us how to deal with this issue - do we have someone to look into the issue or it's only possible via external PR?
thanks

@ileitch
Copy link
Member

ileitch commented May 2, 2018

@soulfly I’m not maintaining this any more, I’ve not personally used it for years. Happy to accept any PRs.

@garettarrowood
Copy link
Collaborator

garettarrowood commented Dec 18, 2018

I will try to take care of this today or in the next couple days.

@benlangfeld
Copy link
Contributor

A solution is proposed in #19.

@garettarrowood
Copy link
Collaborator

Resolved

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

No branches or pull requests

6 participants