On Viernes, 18 de Noviembre de 2011 16:05:08 Hernan Astudillo escribió:
> Hi All,
>
> Many times i've been requested to sort options for select in a different
> way than default, since not allways a<==>b works as we would want (like
> numbers).
> Yeah, you could say: use options_for_association or some other override.
> However that's kinda ugly when you're using chaining forms and other
> features.
>
> It would be nice to have a :sort option so you could pass :sql or a block,
> and by default leave the a<==>b to preserve backwards compatibility
>
> tweaking the method that does the job looks easy, however the option setter
> and passing don't know what you have to do there.
>
> shall i do it myself and send a pull request? i'm kinda new with that
> pulling-pushing thing on github so any help would be appreciated
Add some methods in column to set the sort order. Look at associated_limit for
example:
# to set how many associated records a column with plural association must
show in list
cattr_accessor :associated_limit
@@associated_limit = 3
attr_accessor :associated_limit
.....
def initialize(...)
...
@associated_limit = self.class.associated_limit
...
end
To pass the option add a third parameter, and change method calls to pass the
option
--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.