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?
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?
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.