On Feb 15, 2012, at 4:34 PM, Dl33ter Yay wrote:

> Hi!
> 
> I'm a RoR beginner, and I have a problem with my "app".
> 
> I have a table called " annonces " and a table called " marques ".
> (It's like "post" and "category", for a blog app)
> 
> I'm following the screencast #228 of railscasts, but when I want to sort
> the "Marque" column, it sort by ID and not by name...
> 
> So the question is, how do I do a sortable table column, with multiple
> table?

Could you clarify if you want this to be sortable in the sense of "drag to 
sort", in the sense of "click on a header to sort by that attribute", or simply 
that you want to get the records out in a particular order when you request 
them in your controller?

If you mean the last of these, then you could do something as simple as:

        @marques = Marque.order(:name)

Walter

> 
> If you need some of my code, juste ask what part you want.
> 
> Thanks!
> ++++
> 
> -- 
> Posted via http://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.
> 

-- 
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