I’ve moving on from the data collection part of my app to the data
manipulation part and I’m at loss how to proceed, whether I need to put
asside my rails booka and learn some java or not.
I will have a view that iterates through a collection of objects then in
turn increments another variable to create a series of div elements with
content related to the object and increment. For example Objects [A…E]
, Increments [1…3] yieldsing 15 div’s A1, A2, A3, B1, B2, B3, C1 …
In those divs I will be diplaying images and data based on data in the
object attibutes and the interator.
I would like the entire
want to call a controller method and pass at least the object_id (of
A-E) and the iterator (1-3 in this example). If a button were
acceptable, I think i could have a form with two hidden fields passing
the necessary information in params.
As clicking will call a method which will make changes to the database a
form with a true post might have some advantages(from what i fuzzily
understand)).
I am sorry if this question is very basic… and perhaps not even a
reils question…although I am interested in the rails best practices
solution if there are many solutions.
Do I build a div with some sort of " onclick " that can push an
“invisible??” button within the div containing hidden fields?
Is there a rails helper that will wrap a div to make it clickable and
which I can load with a couple parameters and will that be safe if the
method called will make changes to my database?
in plain english, if I were in the second div A2.
If anywhere in this div is clickced, call method change_user_records
with letter_id = A.id , number = 2
I know that isn’t anywhere close to code but it explains the simple
thing I hope to do and don’t know which tool to turn to.