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.
精彩评论