开发者

selecting specific fields in rails 3.0.1 by using find_by_id method

i would like to select specific field with alias names by method find_by_id , like using the following query

Model.find_by_id(params) # I am getting  all the table columns, 
                         # but i would开发者_运维技巧 like to have only some columns
                         # with alias names.

can you please help me to achieve this?


Model.select('column_name as alias').find_by_id(params)

Unless I am misunderstanding your question.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜