Reputation: 61
I am new to Rails.
I have an ActiveRecord model called Post
. I'd like to get count of all the records of the Post
model. How can I accomplish this?
Thanks in advance for your help.
Upvotes: 4
Views: 10074
Reputation: 4012
Try Post.all.count
in your rails console if you are on Rails 4.
UPDATE:
Post.count
is better as cristian mentioned
Upvotes: 9