find_by_sql( ) can also be used to create model objects containing derived column data. If you use the as xxx SQL syntax to give derived columns a name in the result set, this name will be used as the name of the attribute. items = LineItem.find_by_sql("select *, " + " quantity*unit_price as total_ ...
hghdo
搜索本博客
最近加入圈子
存档
最新评论