I have search the web for help, with the keywords "rails ajax
observe_field update checkbox", but even using all the things I found,
I couldn't really get my application for work properly...
I think I lack of understanding of ajax and rails interaction with
What I would like to do is very simple.
I have a model "Word", with the boolean field "important".
On the index view, which is listing all the "words", I would like to
add a checkbox for each "word", reflecting the state of the
corresponding "important" field.
When I change the state of this checkbox (check or uncheck), I would
like to update (using ajax) the database to change the state of the
"important" field or the corresponding "word", with no page change.
The problem is that I don't know :
- which action (in the words controller) should I call in the :url
field of the observe_field helper,
- wether I should add a new action or not in the words controller
- should I render something or not
- should I transmit the "word id" and the "important" state in the
observe_field use, and how...
Than you in advance.