Checking if ActiveRecord find returns a result

Posted by nickcharlton on Stack Overflow See other posts from Stack Overflow or by nickcharlton
Published on 2010-05-19T14:34:14Z Indexed on 2010/05/19 14:40 UTC
Read the original article Hit count: 82

Filed under:
|

I'm trying to check if a find method returns a result. My find method is the following:

post = Post.find(:all, :conditions => { :url => params['url'] }, :limit => 1)

What would be a good way to check that post contains a result?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about activerecord