Modify ruby hash in place( rails strong params)
This may be more a ruby question then rails question but I'm pretty sure I
was able to do this in a vanilla ruby application.
I have strong params defined.
def trip_params
params.require(:trip).permit(:name, :date)
end
Now I get those params in a controller method. I want to do this.
def save
trip_params[:name] = 'Modifying name in place'
end
This never works. Name never changes. BTW: The type of trip_params is
ActionController::Parameters
If I do a standard ruby script, it works.
test = {}
test[:name] = "blah"
test[:name] = "ok"
puts test #{:name=>"ok"}
No comments:
Post a Comment