In my /app/views/institution/_form.html.erb I have
<%= f.textfield :auto_complete_list %>
Which gets its data from /app/models/institution.rb
def auto_complete_list
return self.county.city.name + ' '+ self.county.name
end
But I don’t want this to be submitted when the button is pressed.
My current solution is to delete it from params[:institution]
Is there a cleaner approach to removing read-only attributes from submit parameters?
While I agree with daekrist’s answer, you can easily keep this out of
params[:institution]by using the lower level form helper methods that:So now when the form is submitted, it will be in
params[:auto_complete_list]instead ofparams[:institution][:auto_complete_list].