Questions with grouped_selcect

34 views
Skip to first unread message

dr.phil

unread,
Oct 1, 2012, 10:43:38 PM10/1/12
to plataformate...@googlegroups.com
In order to implement dynamic select menus, I would like to produce two group select inputs. Both have problems.

The form is for the model treatment.  and medicine (many to many through a join with a model medicine). There is a schedule 

1. Treatment has a field schedule (string). I want to populate the dropdown with the schedule.name from the schedule model group by schedule.type
- Schedule is a separate unrelated model.
- All online examples seem to group based on a relationship.
- <%= f.input :schedule, :collection => Schedule.all, :as => :grouped_select, :group_method => :type %> give an error undefined method `map' for string

2. Treatment has a field for medicine ; joined many to many through TreatmentMedicine. Medicines also have a type attribute.
- How do I create a multiselect for medicines grouped by medicine.type (through this join),

I know these questions require some thought. Any help would be much appreciated.
Reply all
Reply to author
Forward
0 new messages