Note that there are some explanatory texts on larger screens.

plurals
  1. PORake Aborted: Wrong number of arguments (0 for 1)
    text
    copied!<p>I was trying to integrate twitter authentication into my Ruby on Rails application (from the Ruby on Rails Tutorial).</p> <p>As a result I dropped a table (user table ) and had to recreate it. I want to now populate the database and I have this code for populating the table</p> <pre><code>namespace :db do desc "Fill database with sample data" task populate: :environment do User.create!(name: "Example User", email: "example@railstutorial.org", password: "foobar", password_confirmation: "foobar") 99.times do |n| name = Faker::Name.name email = "example-#{n+1}@railstutorial.org" password = "password" User.create!(name: name, email: email, password: password, password_confirmation: password) end end end </code></pre> <p>The following commands work:</p> <pre><code>$bundle exec rake:db migrate $bundle exec rake:db reset </code></pre> <p>However the $bundle exec rake:db populate does NOT work.</p> <p>There are the errors I am getting:</p> <pre><code> $ bundle exec rake db:populate --trace ** Invoke db:populate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:populate rake aborted! wrong number of arguments (0 for 1) c:/Ruby193/lib/ruby/gems/1.9.1/gems/devise-2.0.4/lib/devise/models/database_auth enticatable.rb:105:in `password_digest' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/errors.rb :254:in `block in add_on_blank' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/errors.rb :253:in `each' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/errors.rb :253:in `add_on_blank' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/validatio ns/presence.rb:9:in `validate' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:310:in `_callback_before_39' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:484:in `_run__584816360__validate__204154762__callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:405:in `__run_callback' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:385:in `_run_validate_callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:81:in `run_callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/validatio ns.rb:212:in `run_validations!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/validatio ns/callbacks.rb:53:in `block in run_validations!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:425:in `_run__584816360__validation__204154762__callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:405:in `__run_callback' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:385:in `_run_validation_callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/callb acks.rb:81:in `run_callbacks' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/validatio ns/callbacks.rb:53:in `run_validations!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activemodel-3.2.0/lib/active_model/validatio ns.rb:179:in `valid?' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/validat ions.rb:69:in `valid?' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/validat ions.rb:77:in `perform_validations' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/validat ions.rb:56:in `save!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/attribu te_methods/dirty.rb:33:in `save!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/transac tions.rb:246:in `block in save!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/transac tions.rb:295:in `block in with_transaction_returning_status' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/connect ion_adapters/abstract/database_statements.rb:190:in `transaction' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/transac tions.rb:208:in `transaction' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/transac tions.rb:293:in `with_transaction_returning_status' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/transac tions.rb:246:in `save!' c:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.0/lib/active_record/validat ions.rb:41:in `create!' c:/tuffy/shopgodt/lib/tasks/sample_data.rake:4:in `block (2 levels) in &lt;top (req uired)&gt;' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain' c:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain' c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_lev el' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `each' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handlin g' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:88:in `top_level' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:66:in `block in run' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handlin g' c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run' c:/Ruby193/bin/rake:32:in `&lt;main&gt;' Tasks: TOP =&gt; db:populate </code></pre> <p>Any help on this matter is appreciated. Thanks again!</p> <p>============================================================</p> <p>Update 05/02/2012: Since I had wanted to add third party logins (facebook,twitter) I added the Devise gem but I am not sure which command I ran that resulted in these these two lines that were added to my app/models/User.rb file </p> <pre><code>:token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable </code></pre> <p>Once I commented them out everything ran fine. I would like to understand though what these two lines are doing?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload