Hi all- I am attempting to build a web service that supplies an array of messages, each of which belongs to a user (belongs_to :user). Thus far in my web service, I am only able to return the user_id, not information about the user (e.g. username). Is it possible to follow associations in my Message object to return a structure that includes information on the messages and its author? Thanks, Josh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 12/13/06, Josh <joshua.a.kahn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all- > > I am attempting to build a web service that supplies an array of > messages, each of which belongs to a user (belongs_to :user). Thus far > in my web service, I am only able to return the user_id, not > information about the user (e.g. username). Is it possible to follow > associations in my Message object to return a structure that includes > information on the messages and its author?Nope. -- Kent --- http://www.datanoise.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 -~----------~----~----~----~------~----~------~--~---
On 12/13/06, Josh <joshua.a.kahn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all- > > I am attempting to build a web service that supplies an array of > messages, each of which belongs to a user (belongs_to :user). Thus far > in my web service, I am only able to return the user_id, not > information about the user (e.g. username). Is it possible to follow > associations in my Message object to return a structure that includes > information on the messages and its author?Not directly. I would do a query on the users table using a custom join on the messages table, and return the result as an array of struct''s. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Where do I define the struct? Would this be included in the Rails app/models directory or would I include it as part of a module in the lib directory? Thanks. snacktime wrote:> On 12/13/06, Josh <joshua.a.kahn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi all- > > > > I am attempting to build a web service that supplies an array of > > messages, each of which belongs to a user (belongs_to :user). Thus far > > in my web service, I am only able to return the user_id, not > > information about the user (e.g. username). Is it possible to follow > > associations in my Message object to return a structure that includes > > information on the messages and its author? > > Not directly. I would do a query on the users table using a custom > join on the messages table, and return the result as an array of > struct''s. > > Chris--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---