I want this query into ror form select name from Batch where id = 1 i want only name i tried Batch.find(:all, :conditions => {:id => 1}) it works but Batch.find(:name, :conditions => {:id => 1}) not work please give me suggestion
Batch.where(:id => 1).select(:name)
If you are using Rails 3, you can do
Batch.select(:name).find(1)
I guess you are using Raiils 2.*, in rails 2.x, it should be
Batch.find(:all, :conditions => {:id => 1}, :select => “name”)