assigning role in seed.rb

13 views
Skip to first unread message

bujal

unread,
Mar 25, 2011, 5:09:12 PM3/25/11
to acl9-discuss
Hi I need to create default admin profile in seed.rb.

Tried smoething like this:
user=User.find_or_create_by_email(:login=>'some
login',:password=>'some_pass',:password_confirmation=>'some_pass',:email=>'some...@gmail.com').save!
user.has_role! :admin


But it doesn't work and returns :

undefined method `has_role' for true:TrueClass

Do I need to import the acl9 library into seed.rb? Or is this a bad
way of giving privliges to default user?


Reply all
Reply to author
Forward
0 new messages