Forum: Ruby on Rails invoking an activerecord relation method on the result of a calculation method, which returns a FixN

Posted by John Merlino (johnmerlino)
on 2012-08-12 19:00
(Received via mailing list)
I was seeing these examples in a book:

Person.minimum(:age).where('last_name <> ?', 'Drake')
Person.minimum(:age).having('min(age) > 17').group(:last_name)

The thing is minimum is returning a FixNum. When invoking the relation
methods (e.g. where, having) on a fixnum will raise an exception:

undefined method `where' for 1:Fixnum

So am I missing something here?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.