I’ve got a form like this (simplified, but you get the idea):
<%= form_for(@brand, :html => { :class => "form-horizontal" }) do |f| %>
<%= f.fields_for :prices do |price| %>
<%= price.collection_select(:price, :template_id, Template.all, :id, :name) %>
<% end %>
<%= f.submit "Save", :class => 'btn btn-primary' %>
<% end %>
Which when rendered gives me this error
undefined method `all' for ActionView::Template:Class
on the collection_select line.
Template.all works from the controller and the console. If I write a @templates = Template.all and use @templates in the collection_select line then I get this error:
undefined method `merge' for :name:Symbol
Any thoughts?
Solved it. It was annoyingly simple.
Duplication. Eugh.