I have this controller
def mymethod
@theparam => (params[:valueoftheparam])
@theparam => "3"
callothermethodthatusetheparam
end
So basically, I have "valueoftheparam" which is "2".
I need to change the value of "2" into "3", and let "callothermethodthatusetheparam" the new param (which is "3")
however, "callothermethodthatusetheparam" in the end still used the old value("2").
How I can change this value in the controller, and let "callothermethodthatusetheparam" to use the new param value?
Thank you!
Returns a parameter for the given key.
In the Rails architecture, Action Controller receives incoming requests and hands off each request to a particular action. Action Controller is tightly integrated with Action View; together they form Action Pack. Action Controllers, or just “controllers,” are classes that inherit from ActionController::Base .
You have to modify the value directly, the instance variable does not point to the param, it just clones its value
params[:valueoftheparam] = 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With