
Creating users via migration in production or test environment
Reported by iwakura-taro | February 15th, 2009 @ 11:34 AM
I have application with authlogic.
There are migration for creating initial user
class CreateInitialUserAccount < ActiveRecord::Migration def self.up admin = User.new(:login => 'admin', :password => 'admin', :password_confirmation => 'admin', :admin => true, :proxies_to_buy => 0, :proxies_to_buy_limit_day => 0) admin.save end def self.down User.delete_all end end
It works in development environment,
but in production environment it works only after second try.
Attaching trace.
Comments and changes to this ticket
-
Ben Johnson February 15th, 2009 @ 01:55 PM
- State changed from new to resolved
I dont think your User model is recognizing the new columns since its cached in production. This isnt a problem with Authlogic though. But I would try debugger the User model. Try running User.column_names and see what you get in production.
-
Hugo Duncan February 22nd, 2009 @ 01:06 PM
I had the same issue.
solved by adding the following to the start of the migration.
Object.class_eval do remove_const "User" end load "#{RAILS_ROOT}/app/models/user.rb"
-
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.