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

  • Home
  • SEARCH
  • 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 8325909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:35:37+00:00 2026-06-09T00:35:37+00:00

need to create a wallet for user after user sign up have user model:

  • 0

need to create a wallet for user after user sign up

have user model:

  has_one :wallet, :dependent => :destroy
  after_create :create_wallet

  def create_wallet
    self.wallet.create(params[:wallet])
  end

and wallet model

 class Wallet < ActiveRecord::Base
  belongs_to :user
 end

when sign up, I got this error back

Started POST "/users" for 127.0.0.1 at 2012-08-03 13:40:41 +0300
Creating scope :page. Overwriting existing method User.page.
  Processing by UsersController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"7rgoJQwWFFbo4Wv6gHF2AzwQpCQwB+Pp/kaNRw/YW/k=", "user"=>{"email"=>"rmagnum2002@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign Up"}
Creating scope :page. Overwriting existing method Product.page.
   (0.2ms)  BEGIN
   (0.3ms)  SELECT 1 FROM `users` WHERE `users`.`email` = BINARY 'rmagnum2002@gmail.com' LIMIT 1
   (0.3ms)  SELECT 1 FROM `users` WHERE `users`.`auth_token` = 'S5R9LGhWVn6ut6Uh4h7KCA==' LIMIT 1
  SQL (0.2ms)  INSERT INTO `users` (`auth_token`, `created_at`, `email`, `password_digest`, `password_reset_sent_at`, `password_reset_token`, `updated_at`) VALUES ('S5R9LGhWVn6ut6Uh4h7KCA==', '2012-08-03 10:40:41', 'rmagnum2002@gmail.com', '$2a$10$KnwA.xrFY4z6eao7SmjHM.dq4ypmZZv3Rnk5LT9pg1jpiwxbl2YkK', NULL, NULL, '2012-08-03 10:40:41')
Creating scope :page. Overwriting existing method Wallet.page.
  Wallet Load (0.1ms)  SELECT `wallets`.* FROM `wallets` WHERE `wallets`.`user_id` = 4 LIMIT 1
   (27.2ms)  ROLLBACK
Completed 500 Internal Server Error in 158ms

NameError (undefined local variable or method `params' for #<User:0x9af5894>):
  app/models/user.rb:39:in `create_wallet'
  app/controllers/users_controller.rb:57:in `block in create'
  app/controllers/users_controller.rb:56:in `create'
  app/controllers/application_controller.rb:78:in `catch_not_found'
  app/middleware/flash_session_cookie_middleware.rb:17:in `call'

Rendered vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
Rendered vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
Rendered vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (3.1ms)

the code I built up is based on this answer

Rails 3: After_save create profile

what do I do wrong. Please help. Thank you.

  • 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-06-09T00:35:40+00:00Added an answer on June 9, 2026 at 12:35 am

    The error undefined local variable or method 'params' clearly indicates that params are not available in your model.

    Also, it’s not a good idea to use params in your models. See this question Rails How to pass params from controller to after_save inside model.

    Further, even if you got params in your model, params[:wallet] will not be available because that wasn’t submitted from the web form.

    # No 'wallet' key here.
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"7rgoJQwWFFbo4Wv6gHF2AzwQpCQwB+Pp/kaNRw/YW/k=", "user"=>{"email"=>"rmagnum2002@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign Up"}
    

    UPDATE

    Creating wallet without params

      has_one :wallet, :dependent => :destroy
    
      after_create do |user|
        user.create_wallet
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I need: Create an options menu with Sign in option, when user signs
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
I need to create a WP site which will have multiple subjects. Each subject
Well, i have the following need: create 3 dropdownlist with dependencies. My table in
I need create a link to users/id/microposts where id is the user id. I
I have 2 tables(Companies and Contacts). I need create a list of all of
I want add new user from another script and I need create password for
I need to create a QTreeView based on requests. So, when the user open
I need create a 3D model of and animate a robotic arm. The arm
i have two color red also Salmon. i need create dynamiclly panel also panel

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.