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 6947779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:44:13+00:00 2026-05-27T13:44:13+00:00

I am new to RoR and one methodology I prefer in other languages is

  • 0

I am new to RoR and one methodology I prefer in other languages is the ability to define a fat model. Looking at other examples, the idea seems pretty straight forward, but I am having a bit of an issue with implementing the methodology.

I have a very simple model that I have created for testing:

class Account::User < ActiveRecord::Base
#validates_presense_of :username, :first_name, :last_name, :instance_id, :user_type, :is_active
#validates_uniqueness_of :username  

def self.all_by_user_type(user_type)
  p user_type
end
end

When I attempt to use the method all_by_user_type I get the exception below. Any help with this is greatly appreciated.

irb(main):002:0> u.all_by_user_type(1)
NoMethodError: undefined method all_by_user_type' for #<Account::User:0x7ffe60baebe8>
from /usr/lib/ruby/gems/1.8/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in
method_missing’
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing’
from (irb):2
from :0

  • 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-27T13:44:14+00:00Added an answer on May 27, 2026 at 1:44 pm

    You’re defining a class method, access it by prefixing it with the class name, not an instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys I'm new to RoR and MVC. I've a model which deals with loan
I am new to RoR and I cant get one of my rotes to
I am completely new to RoR. I have a parameter in one view of
I am pretty new to RoR and I am looking to deploy my next
Looking for a way to either: Change one of the fields of a new
Am new to RoR paperclip gem and i have been trying out some examples
i am new to RoR and I am a little confused on this topic.
We are new to ROR, We have issue in creating Login/Logout process in ROR
I'm quite new to RoR. Sorry if I'm using wrong terminology or the answer
I'm new with RoR and I have a controller ( UsersController ) where I

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.