I am trying to create a Rails application in which you can edit the same model from several different places on the page. I want the changes to be saved automatically every X seconds with the option of manually starting the save.
I came up with a solution, but it seems very complicated, and I believe that other Rails users have already faced similar questions.
The solution I came across is that there is a hidden form on my page that is actually presented, and then several βdummyβ forms scattered around the page that update the hidden form.
After submitting, the hidden form updates the model, and the model contains logic to determine which RJS files should be returned in response. They are merged and sent as a response to the update.
some limitations:
- It is impossible to wrap the entire page in one form tag (there are several models / controllers on the page).
- The same field may be editable from several places.
Does anyone have a more efficient way?
ajax ruby-on-rails webforms
shmichael
source share