I have a model called Action. It looks like this:
class Action < ActiveRecord::Base
def register_action(email,type)
@action = new()
@action.guid = "123456789"
@action.email = email
@action.action = type
action.guid if @action.save
end
end
If I try and access this class from my user_controller, I get an error. The code I'm trying to use is :
if (@User.save)
guid = Action.inspect()
guid = Action.register_action(@User.email,"REGISTER")
MemberMailer.deliver_confirmation(@User,guid)
end
Action.inspect() works fine, so I'm guessing that the Action class can be seen, but the line which calls register_action returns the following error:
NoMethodError in UserController#createnew
undefined method `register_action' for #<Class:0x9463a10>
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1994:in `method_missing'
E:/Rails_apps/myapp/app/controllers/user_controller.rb:32:in `createnew'
What am I doing wrong?
I'm new to Rails so apologies for being stupid.