Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 907723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:35:55+00:00 2026-05-15T16:35:55+00:00

I have a model called Action. It looks like this: class Action < ActiveRecord::Base

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:35:56+00:00Added an answer on May 15, 2026 at 4:35 pm

    Problem is on this line:

    guid = Action.register_action(@User.email,"REGISTER")
    

    register_action is an instance method, not a class method, so you call it on an instance of the Action class, not the Action class itself.

    If you want to define register_action as a class method, you should do so like this:

    def self.register_action(email, type)
      # ... Body ...
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some jQuery that looks like this: $.ajax({ type: POST, url: /Customer/CancelSubscription/<%= Model.Customer.Id
I have a model called Contact which has_one guest like so. class Contact <
I have an action that looks like this: [Post] [PopulateModelFromId] public ActionResult ChangeName( string
In ASP.NET MVC I have a controller that looks somehow like this: public class
I have a model called Person. I want User to inherit from Person. class
I have a model called Details, and two controller methods new and create. New
I have a model called company that has_many users then users belongs_to company. class
I have a model called Customer in google app engine with python: class Customer(db.Model):
I have custom UIViewController which looks like this. @implementation UIViewControllerCustom - (id)init { self
I have a model called Event and another called Product. An event has many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.