Quoting RubyonRails_newbie
<craigwesty79-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>:> Hi,
>
> I''m getting the following error, whenever I attempt to accept or
> decline a friend request:
>
> Mysql::Error: Column ''created_at'' in order clause is
ambiguous: SELECT
> `users`.id FROM `users` INNER JOIN `friendships` ON `users`.id >
`friendships`.friend_id WHERE (`users`.`id` = 115) AND
> ((`friendships`.user_id = 114) AND ((status =
''requested''))) ORDER BY
> created_at LIMIT 1
>
> Has anyone seen this before? I looked in the controller, but nothing
> stands out.
>
> Can anyone help?
>
> cheers
The code has a join (or include) with two tables, both of which have
created_at fields. Put the desired table name you intend sort on in the
find) call. Change, find(..., :order => ''created_at'') to
find(..., :order =>
''users.created_at'') or find(..., :order =>
''friendships.created_at'').
Jeffrey
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.