Rails 4 allows (and indeed naggingly demands) that conditions on belongs_to
associations are specified with a scope lambda rather than a conditions option.
e.g. belongs_to :pet, conditions: { breed: 'beagle'}, class_name: 'Dog'
must become
belongs_to :pet, -> { where(breed: 'beagle') }, class_name: 'Dog'
However, the various Hobo and HoboFields alias_method_chain actions on
belongs_to nail down the arguments to (name,options = {}).
This causes an argument count mismatch error at model load time.
Conversely, several wrapping of has_many include the scope lambda argument
for Rails 4 compatibility but are very confusing in a Rails 3 context. They only
work in Rails 3 by accident. (options actually go into a parameter called scope)
I am working on a pull request that will fix this and unite all such adaptations
for has_many and has_one as well with a consistent and robust solution using
variable parameters (*args)
Rails 4 allows (and indeed naggingly demands) that conditions on belongs_to associations are specified with a scope lambda rather than a conditions option. e.g.
belongs_to :pet, conditions: { breed: 'beagle'}, class_name: 'Dog'
must becomebelongs_to :pet, -> { where(breed: 'beagle') }, class_name: 'Dog'
However, the various Hobo and HoboFields alias_method_chain actions on belongs_to nail down the arguments to (name,options = {}). This causes an argument count mismatch error at model load time.
Conversely, several wrapping of has_many include the scope lambda argument for Rails 4 compatibility but are very confusing in a Rails 3 context. They only work in Rails 3 by accident. (options actually go into a parameter called scope)
I am working on a pull request that will fix this and unite all such adaptations for has_many and has_one as well with a consistent and robust solution using variable parameters (*args)