开发者

Rails. Add a virtual attribute to a User object

I am developing an API in Rails 3. I am fetching users from the database. This works fine but I want to add an "attribute" to the output called Contact_data. This "attribute" or what it is called does not have a counterpart in the database I just need it in the JSON output so that I can add an array开发者_如何学Go to it.

How can this be done?

The current output is: http://pastie.org/1849048. I would like for it to appear for example just below the bio attribute.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜