Sha256: 301d0403c8a4f9866e4e5c1e39d6f8923bb301d39b9f94b8979f119c26cbbab9
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 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 = <%= @model_name %>.new(:email => email, :name => "Foo", :surname => "Bar", :password => password, :password_confirmation => password, :role => "admin") if account.valid? account.save shell.say "=================================================================" shell.say "<%= @model_name %> 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 something went wrong!" shell.say "" account.errors.full_messages.each { |m| shell.say " - #{m}" } end shell.say ""
Version data entries
3 entries across 3 versions & 2 rubygems