Ruby on Rails - Adding variable to params[]
- by miligraf
In the controller, how can I add a variable at the end of a params[]?
If I try this I get an error: params[:group_] + variable
How should it be done?
Edit per request
Ok, I have a form that sets groups of radio buttons with names like this:
group_01DRN0
Obviously I have different groups in the form (group_01AAI0, group_01AUI0, etc.) and the value is set according to the radio button selected within the group:
Radio button "group_01DRN0" could have value of "21" or "22" or "23", radio button "group_01AAI0" could have value of "21" or "22" or "23", etc.
In the DB I have every code (01DRN0, 01AAI0, 01AUI0, etc) so I want to select them from DB and iterate in the params value so I can get the radio button group value, I've tried this with no luck:
@codes=Code.get_codes
for c in @codes
@all=params[:group_] + c.name
end
Thanks.