On 22 December 2011 10:55, amvis <[email protected]> wrote:
> can i use like this in ruby on rails
>
> Loyalty.find_by_sql("SELECT COUNT(id) FROM loyalties")
You can do that with :
Loyalty.count
but if you insist on using find_by_sql, you can do this:
Loyalty.find_by_sql("SELECT COUNT(id) as recordcount FROM
loyalties").first.recordcount
Play with this stuff in the console, and read the API docs, and you
won't need to ask these questions
:-/
--
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.