I am using act_as_authenticated plugin for authentication purposes.
Now i need to add an user (Admin) in migration so that i can use this
for authorization purposes.
Issues is how will add an user , i would not know crypted password and
salt?
create_table "users", :force => true do |t|
t.column :login, :string
t.column :email, :string
t.column :crypted_password, :string, :limit => 40
t.column :salt, :string, :limit => 40
t.column :created_at, :datetime
t.column :updated_at, :datetime
t.column :remember_token, :string
t.column :remember_token_expires_at, :datetime
t.column :activation_code, :string, :limit => 40
t.column :activated_at, :datetime
end
is the schema?
Regards,
Sandeep G
User.create(
:login => 'admin',
:password => 'admin',
:password_confirmation => 'admin',
:email => 'ad...@xyz.com'
)
This will create the encrypted password and save to the database.
I tried that, since i am using act_as_authenticated and even the
change_email feature with it, i have new_email in validation.
( validates_length_of :new_email,
:within => 6..100,
:if => :new_email_entered?) )
User.create(
:login => 'admin',
:password => 'admin',
:password_confirmation => 'admin',
:email => 'ad...@xyz.com:activated_at =>
Time.now.utc, :activation_code => nil)
i am thrown : undefine method new_email
i tried this:
User.create(
:login => 'admin',
:password => 'admin',
:password_confirmation => 'admin',
:email => 'ad...@xyz.com:activated_at =>
Time.now.utc, :activation_code => nil, :new_email => nil )
But still no luck.
Oh Sorry! That works! I had a migration with new_email later. That was causing problem! My bad :(