From: Frederick Cheung Date: 2008-08-04T07:02:34+09:00 Subject: Re: Why am I getting "undefined method" error? On 3 Aug 2008, at 22:48, laredotornado wrote: > Hi, > > def self.has_items > FormItem.count(:all, :conditions => ["form_id > = ?", :id]) > end > end > > > but when i try and call this method from another class, > > def new > @form = Form.find_by_user_id(session[:user_id]) > if (@form == nil) > false > else > @form.has_items > end > end > You've defined a class method but you're calling it on an instance (and it looks like it should by a instance method. You could also do away with it altogether and right if @form @form.form_items.any? else false end or even @form && @form.form_items.any? Fred > Any ideas? Thanks, - Dave >