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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:02:45+00:00 2026-05-29T17:02:45+00:00

This is user.rb: # == Schema Information # # Table name: users # #

  • 0

This is user.rb:

# == Schema Information
#
# Table name: users
#
#  id         :integer         not null, primary key
#  name       :string(255)
#  email      :string(255)
#  created_at :datetime        not null
#  updated_at :datetime        not null

class User < ActiveRecord::Base      
  attr_accessible :name, :email, :password, :password_confirmation, :remember_token
  has_secure_password
  before_save :create_remember_token

  validates :name, presence: true, :length => { maximum: 50 }
  valid_email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  validates :email, :presence   => true,
                    :format     => { with: valid_email_regex },
                    :uniqueness => { case_sensitive: false }

  validates :password,  length: { minimum: 6}

  private

    def create_remember_token
      self.remember_token = SecureRandom.urlsafe_base64
    end
end

I have defined the function create_remember_token, but I noticed that in this file I cannot call it. In Rails’ console it didn’t work either:

1.9.2-p290 :002 > User.first.create_remember_token
  User Load (0.4ms)  SELECT "users".* FROM "users" LIMIT 1
NoMethodError: private method `create_remember_token' called for #<User:0x0000010289cda0>
    from /Users/luke/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.2.0/lib/active_model/attribute_methods.rb:404:in `method_missing'
    from /Users/luke/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.0/lib/active_record/attribute_methods.rb:129:in `method_missing'
    from (irb):2
    from /Users/luke/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0/lib/rails/commands/console.rb:47:in `start'
    from /Users/luke/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0/lib/rails/commands/console.rb:8:in `start'
    from /Users/luke/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>

What am I doing wrong?

  • 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-29T17:02:48+00:00Added an answer on May 29, 2026 at 5:02 pm

    Notice the error you’re getting: NoMethodError: private method. Move the method above private and you’ll be able to access it.

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

Sidebar

Related Questions

I've an old table like this: user> id | name | address | comments
EF 4.1 Database First approach. Say I have this table schema Users 1---M UserRoles
I did this: [User.first, User.last].to_xml and got this: <users type=array> <user> <created-at type=datetime>2010-03-16T06:40:51Z</created-at> <id
My Project Model looks like this: # == Schema Information # Schema version: 20101117094659
I have a schema that looks like this User Id INT Username VARCHAR(100) Password
I have this schema which I need to match 2 rows from user_data :
THIS USER HAS ALREADY ASKED THE EXACT DUPLICATE A FEW MINUTES AGO sql and
I have this user defined function. public partial class UserDefinedFunctions { static int i;
I have situation like this: user submits form with action='/pay' in '/pay' I have
I have a controller action that checks this.User.Identity.IsAuthenticated What do you suggest how to

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.