Hello there,
I facing some problems with :include, I want to be able to use the
:select method or I will end up using the :joins :(
JOINS =>
find(:first, :select => "messages.*, users.id as nid,
users.nickname",
:conditions => ["messages.id = ? AND messages.user_from_id =
?",
id, user_id],
:joins => "LEFT JOIN users ON users.id =
messages.user_from_id")
INCLUDE =>
find(:first, :conditions => ["messages.id = ? AND messages.user_from_id
= ? AND messages.deleted_from_id = ?", id, user_id, false],
:include => [:to])
The join let me get the nickname by typing
@message.nickname (Baad)
The include let me get the nickname by typing
@message.to.nickname (This is the way I prefer)
So how I can use the :include and still NOT receive all the information
from the :to table? Because I want to be able to use the
@message.to.nickname instead of @message.nickname
//Thanks for all the help :D
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---