Associations & Web Services

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

Nope.

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

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: