I think I would have a Model method that provides the records as an array of
arrays, each element of the outer array being an array of records with the
same first letter of the name. This would be asked for by the controller and
passed to the view for display as appropriate. The view would put the links
in using appropriate view helper methods.
Or perhaps the Model method would take a collection of records and convert
it to the array of array form. Then one could do
@records = Model.find(......).in_groups or whatever the method is called
2009/5/14 p_W <paulwoolcock83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> I am a novice writing a simple address book app. It is just using the
> simple CRUD operations, but I would like to write a function for the
> index view that divides the records up by the first letter of the last
> name so I can have jump links at the top to take you to a specific
> group of records according to their last name. Should this function
> be put in the controller, or the model?
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---