Hi,
I'm sure this will be an easy one, I'm just not seeing something really obvious. In my app/controllers/sessions_controller.rb file, I have this method:
def create if (log_user_in(params[:login], params[:password], params[:remember_me])) user = User.find(session[:user_id]) if (user.is_subscriber?) # line 11 flash[:notice] = "Logged in successfully" redirect_to :controller => 'admin' else flash[:notice] = "Logged in successfully" redirect_to :controller => 'order', :action => 'new' end else flash[:notice] = "Authentication failed." render :controller => 'register', :action => 'start' end end
and in my User model, I have this method:
class User < ActiveRecord::Base ... def self.is_subscriber? user_type_id == 1 end ... end
but I'm getting this error:
NoMethodError in SessionsController#create undefined method `is_subscriber?' for #<User:0xb795d668> RAILS_ROOT: /usr/local/apache2/htdocs/easyrx Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ attribute_methods.rb:200:in `method_missing' app/controllers/sessions_controller.rb:11:in `create'
What obvious thing am I missing?
Thanks, - Dave