Ryan,

If I understood correctly, he already has an index action that shows
truncated messages. He asked for a 2nd page to show the whole content
of all messages.

He would probably be better off using a nested route for only 1 action
(index) and retrieving the rest of the message asynchronously with
AJAX on-demand, but that might be too much at once.

Cheers, Sazima

On Jan 5, 7:05 pm, Ryan Bigg <[email protected]> wrote:
> Woah.
>
> Firstly, why are you calling .collect on project.messages and  
> everything? This is unnecessary.
>
> Secondly, if messages is an association for a project it would be  
> better if you used nested routes, as explained 
> here:http://guides.rails.info/routing_outside_in.html
> . Your controller would be called messages_controller and the action  
> would be called index, not messages.
> -----
> Ryan Bigg
> Freelancerhttp://frozenplague.net
>
> On 06/01/2009, at 6:02 AM, Dave Smith wrote:
>
>
>
> > Sazima wrote:
> >> 1. Route (config/routes.rb):
>
> >>  map.with_options(:controller => 'messages') do |m|
> >>    m.messages '/messages', :action => 'messages'
> >>  end
>
> >> 2. Action (app/controllers/messages_controller.rb):
>
> >>  def messages
> >>     # Retrieve messages the same way you did in the index action
> >>  end
>
> >> 3. View (app/views/messages/messages.html.erb) => do the same as in
> >> index, but showing the whole message...
>
> >> Cheers, Sazima
>
> >> On Jan 5, 3:20 pm, Dave Smith <[email protected]>
>
> > im slightly confused. i was returning the messages in the projects
> > controller by doing
>
> > @project_messages = @project.messages.collect
>
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to