On 22 Jun 2008, at 16:48, Fredrik Forsmo wrote:
>
> Hello. I was working on a add friend function. Buts i get an mysql
> error.
>
> Mysql::Error: #23000Column ''created_at'' in order clause
is ambiguous:
> SELECT `users`.id FROM `users` INNER JOIN friendships ON users.id >
friendships.friend_id WHERE (`users`.`id` = 2) AND
> ((`friendships`.user_id = 1) AND ((status =
''requested''))) ORDER BY
> created_at LIMIT 1
>
well at the point where you''ve written :order =>
''created_at'' you need
to say ''users.created_at'' or
''friendships.created_at''
Fred> Extracted source (around line #9):
>
> 6: form_tag "/#{controller.controller_name}/#{logged_user ?
> ''logout'' : ''login''}" do %>
> 7:
> 8: <% if logged_user %>
> 9: <% unless @user == current_user ||
> current_user.requested_friends.include?(@user) ||
> current_user.friends.include?(@user) ||
> current_user.pending_friends.include?(@user) %>
> 10: <% form_for(:friendship, :url => user_friends_path(:user_id
=>
> current_user.id, :friend_id => @user.id)) do |f| %>
> 11: <%= submit_tag "Lägg till som vän" %>
> 12:
> --
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---