Got stumped by this one… Had a working form_remote_tag that used
rjs to toggle between a static view of the data and a form with
inputs. Saving that form updated an ActiveRecord model.
Then I realized I needed to move the actions I was using to view/edit/
save this form into the private section of the controller (calling
them directly via URL not a good thing).
Now the Saving doesn’t actually save anything. No crashes, but the
data isn’t updated. I suspect it is because I store the ID of the
object in a session, and somehow the Ajax invocation of the action
fails to restore the session – but why the method being private vs
public would matter to that, I don’t know. Or maybe it is something
else.
The saving method looks like this:
def emergency_contact_save
@client = Client.find(session[:selected_client_id])
@client.emergFirstName = params[:emergFirstName]
..... more params .....
@client.save
respond_to do |request_format|
request_format.js
end
end
works perfect if it is a public method, doesn’t work if it is private.
Not sure what other code I’d need to show.
Any ideas??
– gw