Hi Steve, Interesting question! There are several ways to go:
- You could copy and have your own version of polymorphic select many. Not very nice, as you said. - You could create your own polymorphic tag: <def tag="mysupertag" polymorphic> <select-many merge-attrs/> </def> - We could add "polymorphic" to Hobo's source, in the original definition of select-many. I don't think it would have any negative effect. - Also, if you tell us a bit more about your use case maybe we can think of an alternative. I refer to "whenever an inline form gets auto-generated for one of my models that includes a categories attribute, the input mode would default to check-many instead of the standard select-many.". I think I understand what you mean but with a bit more information I could go ahead and try to play around with a test app. Warm regards, Ignacio El 29/09/14 a las #4, [email protected] escribió: > > Hi Guy. > > I saw this great example of overriding the input mode of a particular > model throughout the entire application in another thread here. > > It looked like this: > > <def tag="input-many" for="Offer"> > <input-many> > <name-one:engineer/> > </input-many> > </def> > > > In this example, any time an object of type Offer is referenced by an > <input-many> tag > (which is the default for direct has_many associations), it will use > this definition > instead of the standard one. > > It's brilliant because it also overrides in the context of automatically > generated > forms in a has_many context (which does not make use of the form tag > but simply throws in a fields tag). > > I'd really like to do the same sort of thing for the <select-many> tag > like this: > > <def tag="select-many" for="Category"> > <check-many options="&Category.all.to_a.sort {|a,b| a.name <=> > b. name}"/> > </def> > > If I could do that, then whenever an inline form gets auto-generated for one > of my models that includes a categories attribute, the input mode would > default > to check-many instead of the standard select-many. > > Alas, the library definition of the select-many tag is not polymorphic > so my specialization of select-many for the Category class is ineffective. > > Is it possible for me to re-define the select-many tag to add polymorphism? > (without having to fork the hobo repository or copy and paste the > entire definition of select-many from the hobo_rapid library to my > application.dryml file) > > - Steve Madere > > > > > > > -- > You received this message because you are subscribed to the Google > Groups "Hobo Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/hobousers. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/hobousers. For more options, visit https://groups.google.com/d/optout.
