Skip to content

Conversation

@alextk
Copy link

@alextk alextk commented Aug 26, 2013

Hi Jeff,

I've discovered extremely annoying bug that is causing active record models to misbehave. If model defines setter methods that change values that are passed, the processed values are reverted back to original values (in new or build assoc methods) by your gem (all logic in setter method is discarded).
For example:

class User
  def email=(value)
    value = value.strip
    write_attribute(:email, value)
  end
end

u = User.new(:email => ' [email protected] ')
u.email  # will return ' [email protected] ', but should return '[email protected]'

Please accept one line fix pull request, which also contains rspec.

Regards,
Alex

@alextk
Copy link
Author

alextk commented Aug 27, 2013

Also, fixed that keys passed to initialize that aren't really activerecord attributes, will not be converted to attributes.

@kianw
Copy link

kianw commented Sep 29, 2013

+1

1 similar comment
@nchainani
Copy link

+1

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.

3 participants