How to pass in a ‘new’ DB setting through fields in RoR

So typically in RoR you pass one object from page to page (in my opinion you do). You are passing the parameters to create “one” new object, etc.
Now what happens when you want to pass in two objects?
You can re-create it by passing in parameters which will re-create and mimic the “one object” way…
It’s a little contorted…
Here’s an example:

<%= hidden_field 'filter', "id", :value => filter.id %>
This generates filter[id] = value yeesh!
To use it:

How to use an “interior” field to specify another DB entry

<%= text_field 'filter_assignment', 'parameter1_setting', "size" => 10, :value => 61 %>

now in the “receiving” model of the post…

newFilterLink = FilterAssignment.new(params[:filter_assignment])

so we setup and used a new “db” entry by generating its parameters. This is just barely nuts, but works. A little bit contorted, as mentioned. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.