Reputation: 666
I'm new to rails, and trying to modify an existing application.
I have a model that has a 'has_many' relationship with another type of record 'group_parameters'. Group parameters has two fields (name and value).
I currently have a form that scopes group_parameters and prints all the stored records. This is achieved by doing
<%= f.fields_for group_parameters do | builder | %>
Attribute <%= builder.text_field(:name) %>
<% end %>
Instead I'd like to only display certain records where the name field equals a specific string. Is there a simple method to help with this?
Upvotes: 1
Views: 158
Reputation: 772
<%= f.fields_for group_parameters, @specific_records do | builder | %>
Attribute <%= builder.text_field(:name) %>
<% end %>
Fetch data from DB as per your criteria and assign to @specific_records
Upvotes: 3