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

account for aliased attributes when attribute methods are mixed in #28

Merged

Conversation

joelvh
Copy link
Contributor

@joelvh joelvh commented Apr 18, 2021

Fixes #27

Moves alias_attribute fixes from state-machines/state_machines-activerecord#95

@joelvh
Copy link
Contributor Author

joelvh commented Apr 18, 2021

@seuros here's the ActiveModel implementation

@joelvh
Copy link
Contributor Author

joelvh commented Apr 18, 2021

@seuros tests pass locally - I can't see details of the build error.

@joelvh
Copy link
Contributor Author

joelvh commented Apr 26, 2021

@seuros are you interested in merging this rather than state-machines/state_machines-activerecord#95?

@joelvh
Copy link
Contributor Author

joelvh commented May 10, 2021

@seuros just checking to see if this is the route to go or the ActiveRecord PR.

@joelvh
Copy link
Contributor Author

joelvh commented Aug 23, 2021

@seuros will this be merged?

@seuros
Copy link
Member

seuros commented Aug 2, 2022

Yes, sorry. I'm back at OSSing.

@seuros seuros self-assigned this Aug 2, 2022
@seuros seuros requested review from seuros and rosskevin August 2, 2022 21:35
@@ -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)
Copy link
Member

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+

@seuros seuros merged commit 33e2a5f into state-machines:master Aug 7, 2022
@joelvh
Copy link
Contributor Author

joelvh commented Aug 7, 2022

hi @seuros, thanks for merging this!

Will this also be merged?

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.

Initializing with aliased state attribute doesn't work
2 participants