Great! that works perfectly. Now what would we need to change to do a group of checkboxes?
An example of where that might make sense would be after chapter 8 where there is a many to many relationship defined between categories and recipes. Again in the recipes form, how might I have the list of categories appear as a group of checkboxes where I could make a multiple selection? Could it be done with a few changes to redefine the radio-one definition above, to make it a group of checkboxes? On Mar 30, 1:04 pm, Bryan Larsen <[email protected]> wrote: > Right, the repeat is changing the context. Try this: > > <!-- radio for a belongs_to --> > <def tag="radio-one" attrs="options,limit"> > <% saved_this = this > conditions = > ActiveRecord::Associations::BelongsToAssociation.new(this_parent, > this_field_reflection).conditions if options.nil? > options ||= this_field_reflection.klass.all(:conditions => > conditions, :limit => limit).select {|x| can_view?(x)} > name = param_name_for_this(true) > %> > <repeat with="&options"> > <input type="radio" name="&name" > value="&this.id" checked="&saved_this==this"/><view/><br/> > </repeat> > </def> -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
