ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-rails
ruby-rails
Re: [Rails] Re: .empty? Method
by Brian V. Hughes other posts by this author
Feb 11 2006 6:14PM messages near this date
[Rails] Re: .empty? Method | [Rails] [ANN] form_remote_upload plugin
Michael Boutros wrote:
>    def view
>      @post = Posts.find(@params["id"])
>      if @post.empty?
>         render_text "Post does not exist."
>      end
>    end

You can't use empty? on a class object. That method isn't supported, which i 
believe is exactly what the error message tried to tell you. You want to check 
to see if the result of the find command has resulted in a defined @post object.

Change the condition to: if @post.nil?

or: unless @post

-Brian
_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Michael Boutros
Nick Stuart
Michael Boutros
Brian V. Hughes

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved