If I have an array of 100 objects of a class called Stream
, like this:
User.find(1001).streams.find( :all, :order => "id", :limit => 100 )
which is basically a data table, how would I select a certain field, such as rating, from it? In SQL, all I need to do is, SELECT rating FROM streams WHERE user_id=1001 ORDER BY id LIMIT 100
, but I don't know how to do that in Ruby on Rails. Using the command above returns all the fields, which I can't use.