undefined method `alias_method_chain' updating Spree from 3.2 to 3.3
For anyone else bumping into this, the multi_fetch_fragments
gem has been merged into rails 5
itself and so the line
gem 'multi_fetch_fragments'
in my Gemfile
was the culprit. Sources:
https://github.com/n8/multi_fetch_fragments/issues/34 and https://github.com/rails/rails/pull/18948
The error was gone after removing this gem from my Gemfile
.
Rails - alias_method_chain with a 'attribute=' method
alias_method_chain
is a simple, two-line method:
def alias_method_chain( target, feature )
alias_method "#{target}_without_#{feature}", target
alias_method target, "#{target}_with_#{feature}"
end
I think the answer you want is to simply make the two alias_method
calls yourself in this case:
alias_method :foo_without_bar=, :foo=
alias_method :foo=, :foo_with_bar=
And you would define your method like so:
def foo_with_bar=(value)
...
end
Ruby symbols process the trailing =
and ?
of method names without a problem.
Replace 'alias_method_chain :save_attachments, :pasted_images' in Rails 5.2.3
Instead of
alias_method_chain :index, :esi
you'll just use
alias_method :index_without_esi, :index
alias_method :index, :index_with_esi
It was some kind of syntactic sugar.
Related Topics
How Does Sinatra Define and Invoke the Get Method
Permanently Switching User in Capistrano 3 (Separate Authorization & Deploy)
Ruby Getting Deeply Nested JSON API Data
Wicked_Pdf Is Not Rendering Header
How to HTML_Escape Text Data in a Sinatra App
Ruby Range: Operators in Case Statement
Can Anyone Explain This Array Declaration to Me
Ternary Expression with "Defined" Returns "Expression" Instead of Value
Ruby: Difference Between Read_Timeout and Open_Timeout
How to Get the Nth Element of an Enumerable in Ruby
Why Does Single '=' Work in 'If' Statement
Rails 3: Belongs_To, Has_One and Migrations
New Way of Creating Hashes in Ruby 2.2.0
Bundler: Not Executable: Script/Delayed_Job
Recursive Rails Nested Resources
Rescuing "Command Not Found" for Io::Popen
Any Ruby Library to Inspect What Are the Arguments That a Certain Methods Take