If you are using Rails 3, you can do

Batch.select(:name).find(1)

On Thu, Feb 16, 2012 at 6:23 PM, Sanjiv Jha <[email protected]> wrote:

> Batch.where(:id => 1).select(:name)
>
>
> On Thu, Feb 16, 2012 at 1:09 PM, $wapnil Patil 
> <[email protected]>wrote:
>
>> 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
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>
>
> --
> Josh Software Private Limited <http://www.joshsoftware.com>
>
> 6, Thube Park,
> Shivaji Nagar,
> Pune - 411005
> Office: +91-020-25539995
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
Either I will find a way or I shall make a way

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to