aantix / turkee

Blurring the line between Mechanical Turk, Rails and usability testing..
http://github.com/aantix/turkee
MIT License
152 stars 39 forks source link

undefined method `assignments=' for #<RTurk::CreateHIT> when calling Turkee::TurkeeTask.create_hit #24

Closed Andrewglass1 closed 11 years ago

Andrewglass1 commented 11 years ago

When I try to run the code to post a new hit,

hit = Turkee::TurkeeTask.create_hit("localhost:3000","Please complete our survey","Tell us your favorite color.","Response",100,0.05,5)

I get this error

NoMethodError: undefined method `assignments=' for #RTurk::CreateHIT:0x007fdfcbf75b68

its occurring in turkee_task.b line 75 in create_hit

Trying to dig in, but not sure exactly whats going on here. It seems like it should be trying to assignments on a RTurk::HIT object, not a RTurk::CreateHIT object, but I'm not sure.

If I try to assign the assignments to the RTurk::HIT object after creation, it does not work. (If I skip that assignments= line, it will work)

aantix commented 11 years ago

Andy, which version of Turkee are you running? If you're not running the master branch, can you do so and see if you still experience the same issue?

gem 'turkee', :git => 'https://github.com/aantix/turkee.git', branch: 'master'
Andrewglass1 commented 11 years ago

hello @aantix !

I was trying to use 2.0.2 when I ran into this originally. I also tried using master but hit another error when hitting TurkeeTask.create_hit

NoMethodError: undefined method unpack' for nil:NilClass /Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/gems/rturk-2.11.0/lib/rturk/requester.rb:77:inhmac_sha1'

aantix commented 11 years ago

Can you paste the full stack trace for that error?

Andrewglass1 commented 11 years ago

sure thing

undefined method `new_object_path' for #<ActionDispatch::Integration::Session:0x007fc6047a1698>
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.13/lib/action_dispatch/testing/assertions/routing.rb:176:in `method_missing'
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/gems/turkee-2.0.2/lib/models/turkee_task.rb:246:in `form_url'
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/gems/turkee-2.0.2/lib/models/turkee_task.rb:239:in `build_url'
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/gems/turkee-2.0.2/lib/models/turkee_task.rb:71:in `create_hit'
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/gems/turkee-2.0.2/lib/tasks/turkee.rb:7:in `block (2 levels) in <top (required)>'
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/Users/andrewglass/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Andrewglass1 commented 11 years ago

sorry @aantix, not sure i posted the right stack trace.

thanks for making this app! love mech turk and I'm looking forward to exploring further

NoMethodError: undefined method `unpack' for nil:NilClass
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/requester.rb:77:in `hmac_sha1'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/requester.rb:71:in `sign'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/requester.rb:29:in `request'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/requester.rb:95:in `Request'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/operation.rb:71:in `request'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/operation.rb:25:in `create'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/operations/create_hit.rb:59:in `CreateHIT'
    from /app/vendor/bundle/ruby/2.0.0/gems/rturk-2.11.0/lib/rturk/adapters/hit.rb:27:in `create'
    from /app/vendor/bundle/ruby/2.0.0/bundler/gems/turkee-8cfe9bd96f2f/lib/models/turkee_task.rb:73:in `create_hit'
    from /app/app/models/hit_creator.rb:19:in `create'
    from /app/app/models/question.rb:9:in `make_hits'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:409:in `_run__4066864448287896349__create__2387731658635395007__callbacks'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/callbacks.rb:268:in `create'
... 9 levels...
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/attribute_methods/dirty.rb:22:in `save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:208:in `transaction'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block in save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/transactions.rb:258:in `save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/persistence.rb:45:in `create'
    from (irb):2
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'irb(main):004
aantix commented 11 years ago

Have you defined your AWS keys in config/initializers/turkee.rb ?

Andrewglass1 commented 11 years ago

Yes, they are defined.

Andrewglass1 commented 11 years ago

I apologize! I double checked and realized they keys were old! Thanks and sorry for the noise

aantix commented 11 years ago

Oh, awesome! Glad you figured it out.