-
Notifications
You must be signed in to change notification settings - Fork 33
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
account for aliased attributes when attribute methods are mixed in #28
account for aliased attributes when attribute methods are mixed in #28
Conversation
@seuros here's the ActiveModel implementation |
@seuros tests pass locally - I can't see details of the build error. |
@seuros are you interested in merging this rather than state-machines/state_machines-activerecord#95? |
@seuros just checking to see if this is the route to go or the ActiveRecord PR. |
@seuros will this be merged? |
Yes, sorry. I'm back at OSSing. |
@@ -407,6 +407,10 @@ def around_validation(object) | |||
def define_state_initializer | |||
define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1 | |||
def initialize(params = {}) | |||
params.transform_keys! do |key| | |||
self.class.attribute_aliases[key.to_s] || key.to_s | |||
end if self.class.respond_to?(:attribute_aliases) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the condition for old AM version ? We will support only 6.0+
Fixes #27
Moves
alias_attribute
fixes from state-machines/state_machines-activerecord#95