Method: ActiveMocker::Queries#count
- Defined in:
- lib/active_mocker/mock/queries.rb
#count(column_name = nil) ⇒ Object
Count the records.
PersonMock.count
# => the total count of all people
PersonMock.count(:age)
# => returns the total count of all people whose age is present in database
260 261 262 263 |
# File 'lib/active_mocker/mock/queries.rb', line 260 def count(column_name = nil) return all.size if column_name.nil? where.not(column_name => nil).size end |