Sha256: 6fc0bd714167841d04aacede439afb53deb97258042f7504bb4cd6cd609af13b
Contents?: true
Size: 1.12 KB
Versions: 11
Compression:
Stored size: 1.12 KB
Contents
# Seed add you the ability to populate your db. # We provide you a basic shell for interaction with the end user. # So try some code like below: # # name = shell.ask("What's your name?") # shell.say name # email = shell.ask "Which email do you want use for logging into admin?" password = shell.ask "Tell me the password to use:" shell.say "" account = <%= options[:admin_model].underscore.camelize %>.create(:email => email, :name => "Foo", :surname => "Bar", :password => password, :password_confirmation => password, :role => "admin") if account.valid? shell.say "=================================================================" shell.say "<%= options[:admin_model].underscore.camelize %> has been successfully created, now you can login with:" shell.say "=================================================================" shell.say " email: #{email}" shell.say " password: #{password}" shell.say "=================================================================" else shell.say "Sorry but some thing went wrong!" shell.say "" account.errors.full_messages.each { |m| shell.say " - #{m}" } end shell.say ""
Version data entries
11 entries across 11 versions & 2 rubygems