I have a code table called priorities. The table has a boolean called archive. I have a request table and it’s form contains a pick list of priorities. I’m using scope statements to tell if a priority is archived or not. This is the code in the model:
scope :archived, where(:archive => true)
scope :active, where(:archive => false)
I’m trying to use the scope in the request form like this:
<%= f.association :priority, :label_method => :prioritycode.active, :label => 'Priority' %>
But, that doesn’t work.
What should I be using in the form?
Thanks!
I may be missing something — not familiar with the
associationhelper you’re using.If you want a drop-down select list, I would do something like
(Assumes you have a model
Priorityin which the scope:activeis defined, and that a priority has aname. Your mileage may vary.)