einzige / sneaky-save

Allows to update complex objects without triggering validations or callbacks.
46 stars 30 forks source link

Rails 5 - undefined method `arel_attributes_with_values_for_create' #21

Open cryptomatictrader opened 6 years ago

cryptomatictrader commented 6 years ago

Anyone is using this gem with Rails 5? It looks like Rails 5 AR doesn't have "arel_attributes_with_values_for_create" anymore and thus it's broken.

Any suggestion?

[2018-08-23 10:08:54.327799 #22071] ERROR: undefined method `arel_attributes_with_values_for_create' for #<Candy:0x00007fd047782fe8>
[2018-08-23 10:08:54.328175 #22071] ERROR: /Users/calvin/.rvm/gems/ruby-2.5.1/gems/activemodel-5.2.1/lib/active_model/attribute_methods.rb:430:in `method_missing'
/Users/calvin/.rvm/gems/ruby-2.5.1/gems/sneaky-save-0.1.3/lib/sneaky-save.rb:87:in `sneaky_attributes_values'
/Users/calvin/.rvm/gems/ruby-2.5.1/gems/sneaky-save-0.1.3/lib/sneaky-save.rb:45:in `sneaky_create'
/Users/calvin/.rvm/gems/ruby-2.5.1/gems/sneaky-save-0.1.3/lib/sneaky-save.rb:33:in `sneaky_create_or_update'
/Users/calvin/.rvm/gems/ruby-2.5.1/gems/sneaky-save-0.1.3/lib/sneaky-save.rb:16:in `sneaky_save'
einzige commented 6 years ago

We'll figure this out soon

robklassy commented 5 years ago

Is there a workaround for this?

tushar0837 commented 3 years ago

any updates here @einzige

yossiedri commented 2 years ago

im having the same error Is there a fix for this? rails 5 ruby 2.6

robklassy commented 2 years ago

@yossiedri I don't think there is a fix, I basically had to write the method myself to make it work