can't define singleton method "encode_with" for BigDecimal - ruby-on-rails

When trying to update one of my models I get the exception can't define singleton method "encode_with" for BigDecimal. I am using Rails 3.0.7 & Ruby 1.9.2.
SkateparksController
def update
#skatepark.update_attributes(params[:skatepark])
end
Full Trace
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/deprecated.rb:16:in `singleton_method_added'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/deprecated.rb:16:in `define_method'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/deprecated.rb:16:in `quick_emit'
activesupport (3.0.7) lib/active_support/core_ext/big_decimal/conversions.rb:15:in `to_yaml'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:55:in `accept'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:227:in `block in visit_Hash'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:225:in `each'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:225:in `visit_Hash'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:36:in `<<'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:165:in `dump'
rspec-mocks (2.6.0) lib/rspec/mocks/extensions/psych.rb:5:in `dump_with_mocks'
/Users/Kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych/core_ext.rb:13:in `psych_to_yaml'
paper_trail (2.2.5) lib/paper_trail/has_paper_trail.rb:158:in `object_to_string'
paper_trail (2.2.5) lib/paper_trail/has_paper_trail.rb:113:in `record_update'
activesupport (3.0.7) lib/active_support/callbacks.rb:415:in `_run_update_callbacks'
activerecord (3.0.7) lib/active_record/callbacks.rb:281:in `update'
activerecord (3.0.7) lib/active_record/persistence.rb:246:in `create_or_update'
activerecord (3.0.7) lib/active_record/callbacks.rb:273:in `block in create_or_update'
activesupport (3.0.7) lib/active_support/callbacks.rb:444:in `_run_save_callbacks'
activerecord (3.0.7) lib/active_record/callbacks.rb:273:in `create_or_update'
activerecord (3.0.7) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.7) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.7) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block (2 levels) in save'
activerecord (3.0.7) lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:207:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block in save'
activerecord (3.0.7) lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
activerecord (3.0.7) lib/active_record/transactions.rb:239:in `save'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:245:in `block in update_address'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:9:in `without_callback'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:244:in `update_address'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:218:in `block in attach_geocode'
activesupport (3.0.7) lib/active_support/callbacks.rb:414:in `_run_geocoding_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:216:in `attach_geocode'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:151:in `block in validates_as_geocodable'
activesupport (3.0.7) lib/active_support/callbacks.rb:470:in `_run_validate_callbacks'
activemodel (3.0.7) lib/active_model/validations.rb:212:in `run_validations!'
activemodel (3.0.7) lib/active_model/validations/callbacks.rb:67:in `block in run_validations!'
activesupport (3.0.7) lib/active_support/callbacks.rb:424:in `_run_validation_callbacks'
activemodel (3.0.7) lib/active_model/validations/callbacks.rb:67:in `run_validations!'
activemodel (3.0.7) lib/active_model/validations.rb:179:in `valid?'
activerecord (3.0.7) lib/active_record/validations.rb:55:in `valid?'
activerecord (3.0.7) lib/active_record/validations.rb:75:in `perform_validations'
activerecord (3.0.7) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.7) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block (2 levels) in save'
activerecord (3.0.7) lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:207:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block in save'
activerecord (3.0.7) lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
activerecord (3.0.7) lib/active_record/transactions.rb:239:in `save'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:245:in `block in update_address'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:9:in `without_callback'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:244:in `update_address'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:218:in `block in attach_geocode'
activesupport (3.0.7) lib/active_support/callbacks.rb:414:in `_run_geocoding_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:216:in `attach_geocode'
acts_as_geocodable (2.0.2) lib/acts_as_geocodable.rb:151:in `block in validates_as_geocodable'
activesupport (3.0.7) lib/active_support/callbacks.rb:470:in `_run_validate_callbacks'
activemodel (3.0.7) lib/active_model/validations.rb:212:in `run_validations!'
activemodel (3.0.7) lib/active_model/validations/callbacks.rb:67:in `block in run_validations!'
activesupport (3.0.7) lib/active_support/callbacks.rb:424:in `_run_validation_callbacks'
activemodel (3.0.7) lib/active_model/validations/callbacks.rb:67:in `run_validations!'
activemodel (3.0.7) lib/active_model/validations.rb:179:in `valid?'
activerecord (3.0.7) lib/active_record/validations.rb:55:in `valid?'
activerecord (3.0.7) lib/active_record/validations.rb:75:in `perform_validations'
activerecord (3.0.7) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.7) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block (2 levels) in save'
activerecord (3.0.7) lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:207:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block in save'
activerecord (3.0.7) lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
activerecord (3.0.7) lib/active_record/transactions.rb:239:in `save'
activerecord (3.0.7) lib/active_record/persistence.rb:128:in `block in update_attributes'
activerecord (3.0.7) lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:207:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/persistence.rb:126:in `update_attributes'
app/controllers/admin/skateparks_controller.rb:54:in `update'
actionpack (3.0.7) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.7) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.7) lib/active_support/callbacks.rb:472:in `block in _run__3889911993370107397__process_action__388168845574438513__callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:221:in `block in _conditional_callback_around_218'
activesupport (3.0.7) lib/active_support/callbacks.rb:331:in `around'
activesupport (3.0.7) lib/active_support/callbacks.rb:315:in `_callback_around_33'
activesupport (3.0.7) lib/active_support/callbacks.rb:220:in `_conditional_callback_around_218'
activesupport (3.0.7) lib/active_support/callbacks.rb:436:in `_run__3889911993370107397__process_action__388168845574438513__callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.7) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.7) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.7) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.7) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.7) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.7) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:82:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:493:in `call'
oa-core (0.2.6) lib/omniauth/strategy.rb:44:in `call!'
oa-core (0.2.6) lib/omniauth/strategy.rb:30:in `call'
oa-core (0.2.6) lib/omniauth/strategy.rb:44:in `call!'
oa-core (0.2.6) lib/omniauth/strategy.rb:30:in `call'
oa-core (0.2.6) lib/omniauth/strategy.rb:44:in `call!'
oa-core (0.2.6) lib/omniauth/strategy.rb:30:in `call'
oa-core (0.2.6) lib/omniauth/builder.rb:30:in `call'
sass (3.1.3) lib/sass/plugin/rack.rb:54:in `call'
warden (1.0.4) lib/warden/manager.rb:35:in `block in call'
warden (1.0.4) lib/warden/manager.rb:34:in `catch'
warden (1.0.4) lib/warden/manager.rb:34:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.3) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
flash_cookie_session (1.1.1) lib/flash_cookie_session/middleware.rb:18:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.7) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.7) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.7) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.7) lib/rails/application.rb:168:in `call'
railties (3.0.7) lib/rails/application.rb:77:in `method_missing'
railties (3.0.7) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/chunked.rb:15:in `call'
thin (1.2.11) lib/thin/connection.rb:84:in `block in pre_process'
thin (1.2.11) lib/thin/connection.rb:82:in `catch'
thin (1.2.11) lib/thin/connection.rb:82:in `pre_process'
thin (1.2.11) lib/thin/connection.rb:57:in `process'
thin (1.2.11) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.2.11) lib/thin/backends/base.rb:61:in `start'
thin (1.2.11) lib/thin/server.rb:159:in `start'
rack (1.2.3) lib/rack/handler/thin.rb:14:in `run'
rack (1.2.3) lib/rack/server.rb:217:in `start'
railties (3.0.7) lib/rails/commands/server.rb:65:in `start'
railties (3.0.7) lib/rails/commands.rb:30:in `block in <top (required)>'
railties (3.0.7) lib/rails/commands.rb:27:in `tap'
railties (3.0.7) lib/rails/commands.rb:27:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

It might be because of a YAML parser error. I had a similar error which I fixed using the following code:
#in config/boot.rb
require 'rubygems'
require 'yaml'
YAML::ENGINE.yamler= 'syck'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
......
I have seen this error in ubuntu 10.10+ machines

I had a similar problem using jruby 1.6.5, ruby 1.9 and rails 2.3.14 on windows
$ jruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [Windows 7-amd64-java]
I was able to get around this by looking at the fix for rails 3. All I had to do was to add a file (I called it fix_big_decimal.rb) to my config/initializers:
module ActiveSupport
module CoreExtensions
module BigDecimal
module Conversions
def encode_with(coder)
string = to_s
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
end
# Backport this method if it doesn't exist
unless method_defined?(:to_d)
def to_d
self
end
end
end
end
end
end

Related

ArgumentError, wrong number of arguments (2 for 0) in create action, works on Heroku but not on local server

I recently had a RoR application developed for me by a third party and now I'm on my own to add future features that I want. It works on Heroku, but when I try to run it on localhost:3000, I get an ArgumentError. I have not changed any of the code, I just pulled it from github and tried to run it on a local development server to implement new changes. I've asked them about this problem, but they are not sure of the cause, so here goes...
We're running ruby 1.9.2, rails 3.0.7
Whenever I try to save a project on my site, or whenever .save is called on an object, I get an ArgumentError, wrong number of arguments (2 for 0).
Application Trace
app/controllers/users/projects_controller.rb:24:in `create'
Full Trace
activesupport (3.0.7) lib/active_support/ordered_hash.rb:16:in `block in to_yaml'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/deprecated.rb:19:in `call'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/deprecated.rb:19:in `block in quick_emit'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:296:in `dump_coder'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:61:in `accept'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:36:in `<<'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:165:in `dump'
activerecord (3.0.7) lib/active_record/base.rb:1720:in `block in arel_attributes_values'
activerecord (3.0.7) lib/active_record/base.rb:1713:in `each'
activerecord (3.0.7) lib/active_record/base.rb:1713:in `arel_attributes_values'
activerecord (3.0.7) lib/active_record/persistence.rb:265:in `create'
activerecord (3.0.7) lib/active_record/timestamp.rb:47:in `create'
activerecord (3.0.7) lib/active_record/callbacks.rb:277:in `block in create'
activesupport (3.0.7) lib/active_support/callbacks.rb:414:in `_run_create_callbacks'
activerecord (3.0.7) lib/active_record/callbacks.rb:277:in `create'
activerecord (3.0.7) lib/active_record/persistence.rb:246:in `create_or_update'
activerecord (3.0.7) lib/active_record/callbacks.rb:273:in `block in create_or_update'
activesupport (3.0.7) lib/active_support/callbacks.rb:424:in `_run_save_callbacks'
activerecord (3.0.7) lib/active_record/callbacks.rb:273:in `create_or_update'
activerecord (3.0.7) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.7) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.7) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block (2 levels) in save'
activerecord (3.0.7) lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:207:in `transaction'
activerecord (3.0.7) lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
activerecord (3.0.7) lib/active_record/transactions.rb:240:in `block in save'
activerecord (3.0.7) lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
activerecord (3.0.7) lib/active_record/transactions.rb:239:in `save'
app/controllers/users/projects_controller.rb:24:in `create'
actionpack (3.0.7) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.7) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.7) lib/active_support/callbacks.rb:448:in `_run__334044120__process_action__677517956__callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.7) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.7) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.7) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.7) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.7) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.7) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:493:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) lib/warden/manager.rb:34:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.4) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.7) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.7) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.4) lib/rack/sendfile.rb:106:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.7) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.4) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.4) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.4) lib/rack/lock.rb:11:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.7) lib/rails/application.rb:168:in `call'
railties (3.0.7) lib/rails/application.rb:77:in `method_missing'
railties (3.0.7) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.4) lib/rack/content_length.rb:13:in `call'
rack (1.2.4) lib/rack/handler/webrick.rb:52:in `service'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2- p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2- p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/squizzleflip/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
the code from projects_controller, line 24 is the if statement
def create
#project = Project.new(params[:project])
#project.memberships.build(:user_id => current_profile.id, :pending => false)
if #project.save
redirect_to destination, :notice => 'Project was successfully created.'
else
build_project_associations_for_nested_forms
render :action => 'new'
end
end
I'm a bit new at this, so I'm not quite sure what else is needed to determine the problem.
Have you tried running something other than WEBrick (assuming you're using that)? Try installing Thin (gem install thin) and see if the problem persists.
Make sure that you have got all the required gem, run bundle install:
bundle install
Restart the app, hopefully that helps.

ImageScience w/ Rails 3

I'm trying to get ImageScience working w/ my rails 3 app. When I try to do require 'image_science' in one of my controllers I get:
LoadError in Api::ImagesController#server
require on /Users/Kyle/.ruby_inline/Inline_ImageScience_cdab.bundle failed
This error occurred while loading the following files:
image_science
Full Trace
RubyInline (3.9.0) lib/inline.rb:513:in `load'
RubyInline (3.9.0) lib/inline.rb:829:in `inline'
image_science (1.2.1) lib/image_science.rb:90:in `<class:ImageScience>'
image_science (1.2.1) lib/image_science.rb:13:in `<top (required)>'
activesupport (3.0.7) lib/active_support/dependencies.rb:239:in `require'
activesupport (3.0.7) lib/active_support/dependencies.rb:239:in `block in require'
activesupport (3.0.7) lib/active_support/dependencies.rb:225:in `block in load_dependency'
activesupport (3.0.7) lib/active_support/dependencies.rb:596:in `new_constants_in'
activesupport (3.0.7) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.7) lib/active_support/dependencies.rb:239:in `require'
app/controllers/api/images_controller.rb:3:in `<top (required)>'
activesupport (3.0.7) lib/active_support/dependencies.rb:454:in `load'
activesupport (3.0.7) lib/active_support/dependencies.rb:454:in `block in load_file'
activesupport (3.0.7) lib/active_support/dependencies.rb:596:in `new_constants_in'
activesupport (3.0.7) lib/active_support/dependencies.rb:453:in `load_file'
activesupport (3.0.7) lib/active_support/dependencies.rb:340:in `require_or_load'
activesupport (3.0.7) lib/active_support/dependencies.rb:491:in `load_missing_constant'
activesupport (3.0.7) lib/active_support/dependencies.rb:183:in `block in const_missing'
activesupport (3.0.7) lib/active_support/dependencies.rb:181:in `each'
activesupport (3.0.7) lib/active_support/dependencies.rb:181:in `const_missing'
activesupport (3.0.7) lib/active_support/inflector/methods.rb:124:in `block in constantize'
activesupport (3.0.7) lib/active_support/inflector/methods.rb:123:in `each'
activesupport (3.0.7) lib/active_support/inflector/methods.rb:123:in `constantize'
activesupport (3.0.7) lib/active_support/dependencies.rb:528:in `block in <class:Reference>'
activesupport (3.0.7) lib/active_support/dependencies.rb:538:in `yield'
activesupport (3.0.7) lib/active_support/dependencies.rb:538:in `default'
activesupport (3.0.7) lib/active_support/dependencies.rb:538:in `get'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:58:in `controller_reference'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:23:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:89:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:493:in `call'
oa-core (0.2.6) lib/omniauth/strategy.rb:44:in `call!'
oa-core (0.2.6) lib/omniauth/strategy.rb:30:in `call'
oa-core (0.2.6) lib/omniauth/strategy.rb:44:in `call!'
oa-core (0.2.6) lib/omniauth/strategy.rb:30:in `call'
oa-core (0.2.6) lib/omniauth/strategy.rb:44:in `call!'
oa-core (0.2.6) lib/omniauth/strategy.rb:30:in `call'
oa-core (0.2.6) lib/omniauth/builder.rb:30:in `call'
sass (3.1.3) lib/sass/plugin/rack.rb:54:in `call'
warden (1.0.4) lib/warden/manager.rb:35:in `block in call'
warden (1.0.4) lib/warden/manager.rb:34:in `catch'
warden (1.0.4) lib/warden/manager.rb:34:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.3) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
flash_cookie_session (1.1.1) lib/flash_cookie_session/middleware.rb:18:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.7) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.7) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.7) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.7) lib/rails/application.rb:168:in `call'
railties (3.0.7) lib/rails/application.rb:77:in `method_missing'
railties (3.0.7) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/chunked.rb:15:in `call'
thin (1.2.11) lib/thin/connection.rb:84:in `block in pre_process'
thin (1.2.11) lib/thin/connection.rb:82:in `catch'
thin (1.2.11) lib/thin/connection.rb:82:in `pre_process'
thin (1.2.11) lib/thin/connection.rb:57:in `process'
thin (1.2.11) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.2.11) lib/thin/backends/base.rb:61:in `start'
thin (1.2.11) lib/thin/server.rb:159:in `start'
rack (1.2.3) lib/rack/handler/thin.rb:14:in `run'
rack (1.2.3) lib/rack/server.rb:217:in `start'
railties (3.0.7) lib/rails/commands/server.rb:65:in `start'
railties (3.0.7) lib/rails/commands.rb:30:in `block in <top (required)>'
railties (3.0.7) lib/rails/commands.rb:27:in `tap'
railties (3.0.7) lib/rails/commands.rb:27:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

strange error while sending confirmation email through devise on rails 3.0.3, ruby 1.8.7

I am using devise 1.3.4 on Rails 3.0.3 and ruby 1.8.7 for user authentication/authorization and new user creation. (I followed Ryan's railscast on devise and omniauth but also used the confirmable option)
It works just fine when there are no users in the database. However, when I signout the only user and try to create a new one, I get the following error:
undefined method `encode!' for "Confirmation":String
Here's the full stack trace:
ail (2.2.17) lib/mail/fields/unstructured_field.rb:169:in `encode'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:138:in `fold'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:108:in `wrapped_value'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:70:in `do_encode'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:52:in `encoded'
mail (2.2.17) lib/mail/field.rb:122:in `send'
mail (2.2.17) lib/mail/field.rb:122:in `method_missing'
mail (2.2.17) lib/mail/header.rb:190:in `encoded'
mail (2.2.17) lib/mail/header.rb:189:in `each'
mail (2.2.17) lib/mail/header.rb:189:in `encoded'
mail (2.2.17) lib/mail/message.rb:1707:in `encoded'
actionmailer (3.0.3) lib/action_mailer/base.rb:420:in `set_payload_for_mail'
actionmailer (3.0.3) lib/action_mailer/base.rb:400:in `deliver_mail'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionmailer (3.0.3) lib/action_mailer/base.rb:399:in `deliver_mail'
mail (2.2.17) lib/mail/message.rb:230:in `deliver'
devise (1.3.4) lib/devise/models/confirmable.rb:50:in `send_confirmation_instructions'
activesupport (3.0.3) lib/active_support/callbacks.rb:425:in `_run_create_callbacks'
activerecord (3.0.3) lib/active_record/callbacks.rb:281:in `create'
activerecord (3.0.3) lib/active_record/persistence.rb:246:in `create_or_update'
activerecord (3.0.3) lib/active_record/callbacks.rb:277:in `create_or_update'
activesupport (3.0.3) lib/active_support/callbacks.rb:418:in `_run_save_callbacks'
activerecord (3.0.3) lib/active_record/callbacks.rb:277:in `create_or_update'
activerecord (3.0.3) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.3) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.3) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:289:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:204:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
activerecord (3.0.3) lib/active_record/transactions.rb:236:in `save'
devise (1.3.4) app/controllers/devise/registrations_controller.rb:16:in `create'
app/controllers/registrations_controller.rb:3:in `create'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:445:in `_run__799082383__process_action__1623385099__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `send'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `send'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:120:in `process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.3) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/mapper.rb:35:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:89:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/builder.rb:30:in `call'
warden (1.0.4) lib/warden/manager.rb:35:in `call'
warden (1.0.4) lib/warden/manager.rb:34:in `catch'
warden (1.0.4) lib/warden/manager.rb:34:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.2) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in `call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.2) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `send'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.2) lib/rack/content_length.rb:13:in `call'
rack (1.2.2) lib/rack/handler/webrick.rb:52:in `service'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.2) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.2) lib/rack/server.rb:213:in `start'
railties (3.0.3) lib/rails/commands/server.rb:65:in `start'
railties (3.0.3) lib/rails/commands.rb:30
railties (3.0.3) lib/rails/commands.rb:27:in `tap'
railties (3.0.3) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
Please help me out with this!
String#encode! is new in Ruby 1.9 so its just not there in 1.8.7. So it looks as though the mail gem that you are using has a dependency on 1.9.

Rails and Paperclip Errno::EACCES Permission denied

I'm stuck with this for days. I keep getting this error trying to upload image:
Errno::EACCES in MyController#create
Permission denied - c:\"Program Files\ImageMagick-6.6.9-Q16"/convert "C:/Users/USER/AppData/Local/Temp/stream20110522-5332-1e34ydw.jpg[0]" -resize "848x608!" "C:/Users/USER/AppData/Local/Temp/stream20110522-5332-1e34ydw20110522-5332-z5iv1g" 2>NUL
when I copy this line above to the command line and run it, it works - no permission denied error. What should I do to allow ruby do it?
I'm running on:
Windows 7
WEBrick 1.3.1
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
rails (3.0.7)
Paperclip - I've tried versions 2.3.11, 2.3.4, and 2.3.6, and 2.3.10 but I still keep getting the same error.
I've googled a lot for a solution and aplied the tempfile fsync fix found on [http://thewebfellas.com/blog/2008/11/2/goodbye-attachment_fu-hello-paperclip][1]
and also
the file.mv replacement with copy and delete, in tempfile, that looked like the solution, but that doesn't help. These fixes besides seems to be in the newer versions of paperclip by default.
Of course I restarted webrick allways I made any changes.
The console info by server, when this problem rises:
Started POST "/admin/front_campaigns" for 127.0.0.1 at 2011-05-22 12:35:10 +0200
Processing by FrontCampaignsController#create as HTML
Parameters: {"utf8"=>"Ôťô",
"authenticity_token"=>"DwX4TRaU1wGOleyxhjzpcmmg2m9pbtzLOj1WOa48cXc=", "front_campaign"=>
{"picture"=>#<ActionDispatch::Http::UploadedFile:0x41bd508 #original_filename="home1.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"front_campaign
[picture]\"; filename=\"home1.jpg\"\r\nContent-Type: image/jpeg\r\n", #tempfile=#<File:C:/Users/USER/AppData/Local/Temp/RackMultipart20110522-5292-2recc
l>>, "name"=>"", "description"=>"", "web"=>"", "position_x"=>"1", "position_y"=>"1"}, "commit"=>"Create Front campaign"}
[paperclip] c:\"Program Files\ImageMagick-6.6.9-Q16"/identify -format %wx%h "C:/Users/USER/AppData/Local/Temp/stream20110522-5292-ks7a6r.jpg[0]" 2>NUL
[paperclip] c:\"Program Files\ImageMagick-6.6.9-Q16"/convert "C:/Users/USER/AppData/Local/Temp/stream20110522-5292-ks7a6r.jpg[0]" -resize "848x608!" "C:
/Users/USER/AppData/Local/Temp/stream20110522-5292-ks7a6r20110522-5292-17svo7l" 2>NUL
Completed in 360ms
Errno::EACCES (Permission denied - c:\"Program Files\ImageMagick-6.6.9-Q16"/convert "C:/Users/USER/AppData/Local/Temp/stream20110522-5292-ks7a6r.jpg[0]"
-resize "848x608!" "C:/Users/USER/AppData/Local/Temp/stream20110522-5292-ks7a6r20110522-5292-17svo7l" 2>NUL):
app/controllers/front_campaigns_controller.rb:44:in `new'
app/controllers/front_campaigns_controller.rb:44:in `create'
/sorry for the formating, I was unable to get a nicer copy of windows commandline/
full trace:
activesupport (3.0.7) lib/active_support/core_ext/kernel/agnostics.rb:7:in ``'
activesupport (3.0.7) lib/active_support/core_ext/kernel/agnostics.rb:7:in ``'
paperclip (2.3.10) lib/paperclip/command_line.rb:27:in `run'
paperclip (2.3.10) lib/paperclip.rb:104:in `run'
paperclip (2.3.10) lib/paperclip/thumbnail.rb:61:in `make'
paperclip (2.3.10) lib/paperclip/processor.rb:33:in `make'
paperclip (2.3.10) lib/paperclip/attachment.rb:344:in `block (2 levels) in post_process_styles'
paperclip (2.3.10) lib/paperclip/attachment.rb:343:in `each'
paperclip (2.3.10) lib/paperclip/attachment.rb:343:in `inject'
paperclip (2.3.10) lib/paperclip/attachment.rb:343:in `block in post_process_styles'
paperclip (2.3.10) lib/paperclip/attachment.rb:339:in `each'
paperclip (2.3.10) lib/paperclip/attachment.rb:339:in `post_process_styles'
paperclip (2.3.10) lib/paperclip/attachment.rb:333:in `block (2 levels) in post_process'
activesupport (3.0.7) lib/active_support/callbacks.rb:414:in `_run_picture_post_process_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
paperclip (2.3.10) lib/paperclip/callback_compatability.rb:54:in `run_paperclip_callbacks'
paperclip (2.3.10) lib/paperclip/attachment.rb:332:in `block in post_process'
activesupport (3.0.7) lib/active_support/callbacks.rb:414:in `_run_post_process_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
paperclip (2.3.10) lib/paperclip/callback_compatability.rb:54:in `run_paperclip_callbacks'
paperclip (2.3.10) lib/paperclip/attachment.rb:331:in `post_process'
paperclip (2.3.10) lib/paperclip/attachment.rb:110:in `assign'
paperclip (2.3.10) lib/paperclip.rb:252:in `block in has_attached_file'
activerecord (3.0.7) lib/active_record/base.rb:1559:in `block in attributes='
activerecord (3.0.7) lib/active_record/base.rb:1555:in `each'
activerecord (3.0.7) lib/active_record/base.rb:1555:in `attributes='
activerecord (3.0.7) lib/active_record/base.rb:1407:in `initialize'
app/controllers/front_campaigns_controller.rb:44:in `new'
app/controllers/front_campaigns_controller.rb:44:in `create'
actionpack (3.0.7) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.7) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.7) lib/active_support/callbacks.rb:446:in `_run__41168123__process_action__129617020__callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:30:in `block in
process_action'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.7) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.7) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.7) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.7) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.7) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.7) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:62:in `dispa
tch'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:493:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.2) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.7) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in
`cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.7) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.7) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.7) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.2) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.7) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
actionpack (3.0.7) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.7) lib/rails/application.rb:168:in `call'
railties (3.0.7) lib/rails/application.rb:77:in `method_missing'
railties (3.0.7) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.2) lib/rack/content_length.rb:13:in `call'
rack (1.2.2) lib/rack/handler/webrick.rb:52:in `service'
C:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
C:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
C:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Any ideas how to fix this?
Thanks a lot
EDIT:
the request parameters are:
{"utf8"=>"✓",
"authenticity_token"=>"DwX4TRaU1wGOleyxhjzpcmmg2m9pbtzLOj1WOa48cXc=",
"front_campaign"=>{"picture"=>#<ActionDispatch::Http::UploadedFile:0x3fe1b10
#original_filename="home1.jpg",
#content_type="image/jpeg",
#headers="Content-Disposition: form-data; name=\"front_campaign[picture]\"; filename=\"home1.jpg\"\r\nContent-Type: image/jpeg\r\n",
#tempfile = File:C:/Users/USER/AppData/Local/Temp/RackMultipart20110522-4824-1tyjwrv>, // this tempfile is created
"name"=>""},
"commit"=>"Create Front campaign"}
OK, I finally found a solution, it was kinda stupid:
I reinstalled the ImageMagick, and instead of using the default folder in Program Files, I picked folder C:\im, than I set the
Paperclip.options[:command_path] = "C:\\im"
in development.rb and now it works perfectly, with and without the styles options.
Thanks to everyone who tried to help.

rails2 to rails3 upgrade problem

I am trying to upgrade my application from Rails 2.3.5 to Rails 3.0.3.
Models:
Project.rb
has_many :project_roles, :dependent => :destroy
alias :roles :project_roles
after_create :create_cal_for_project, :make_project_owner
def create_calendar_for_project
self.calendars.create(:name => "default")
end
def make_project_owner
#Make owner of project when created
self.roles.create(:user => User.curr_user, :name => 'O')
end
ProjectRole.rb
belongs_to :project
belongs_to :user
project_roles table columns are user_id, project_id, name
I am getting a hard time with the following error, please suggest.
Thanks.
→ rails c
> Loading development environment (Rails 3.0.3)
ruby-1.9.2-p0> User.curr_user = User.first
=> #<User id: 1, username: "tispratik", login_email: "tispratik#gmail.com", > is_email_verified: nil, crypted_password: "deed6fa27ffefa57e63592a9b59295abf2660447cf281f34857...", password_salt: "YsD2nLte3pZy1FZ78GD", persistence_token: "84e44908be77b2dc1e41f8dfeacf9ef20c30050ff0c53854e0d...", single_access_token: "cp1bqVSheDh7vl9J48V", perishable_token: "6pGPzdw48nJnJAHsIZQW", last_login_ip: nil, last_login_at: nil, created_at: "2010-11-23 06:00:09", updated_at: "2010-11-23 06:00:09">
ruby-1.9.2-p0> p = Project.create(:name => "ad", :description => "add")
NoMethodError: undefined method `name' for nil:NilClass
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/to_sql.rb:57:in `block in visit_Arel_Nodes_InsertStatement'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/to_sql.rb:56:in `map'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/to_sql.rb:56:in `visit_Arel_Nodes_InsertStatement'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/visitor.rb:15:in `visit'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/visitor.rb:5:in `accept'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/to_sql.rb:19:in `block in accept'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:110:in `with_connection'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/visitors/to_sql.rb:17:in `accept'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/tree_manager.rb:19:in `to_sql'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/arel-2.0.4/lib/arel/select_manager.rb:191:in `insert'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/relation.rb:14:in `insert'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/persistence.rb:270:in `create'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/timestamp.rb:47:in `create'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/callbacks.rb:281:in `block in create'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:413:in `_run_create_callbacks'
... 30 levels...
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/attribute_methods/dirty.rb:21:in `save'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:237:in `block (2 levels) in save'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:289:in `block in with_transaction_returning_status'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:204:in `transaction'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:237:in `block in save'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/transactions.rb:236:in `save'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/base.rb:498:in `create'
from (irb):2
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from /home/pratik/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
The problem is in the make_project_owner callback. create_calendar_for_project runs just fine.
I changed make_project_owner to the following still the same problem occurs.
def make_project_owner
#Make owner of project when created
#role.create(:user => User.curr_user, :name => 'O')
ProjectRole.create(:user => User.curr_user, :project => self, :name => "O")
end
I tried downgrading rails:
rails 3.0.2 -> has same problem
rails 3.0.1 -> has different error
undefined method `name' for #<Arel::Value:0x00000005795090>
Application Trace | Framework Trace | Full Trace
arel (1.0.1) lib/arel/engines/sql/engine.rb:26:in `block in create'
arel (1.0.1) lib/arel/engines/sql/engine.rb:26:in `each'
arel (1.0.1) lib/arel/engines/sql/engine.rb:26:in `detect'
arel (1.0.1) lib/arel/engines/sql/engine.rb:26:in `create'
arel (1.0.1) lib/arel/algebra/relations/writes.rb:24:in `call'
arel (1.0.1) lib/arel/session.rb:17:in `create'
arel (1.0.1) lib/arel/algebra/relations/relation.rb:159:in `insert'
activerecord (3.0.1) lib/active_record/relation.rb:14:in `insert'
activerecord (3.0.1) lib/active_record/persistence.rb:271:in `create'
activerecord (3.0.1) lib/active_record/timestamp.rb:47:in `create'
activerecord (3.0.1) lib/active_record/callbacks.rb:281:in `block in create'
activesupport (3.0.1) lib/active_support/callbacks.rb:413:in `_run_create_callbacks'
activerecord (3.0.1) lib/active_record/callbacks.rb:281:in `create'
activerecord (3.0.1) lib/active_record/persistence.rb:247:in `create_or_update'
activerecord (3.0.1) lib/active_record/callbacks.rb:277:in `block in create_or_update'
activesupport (3.0.1) lib/active_support/callbacks.rb:423:in `_run_save_callbacks'
activerecord (3.0.1) lib/active_record/callbacks.rb:277:in `create_or_update'
activerecord (3.0.1) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.1) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.1) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.1) lib/active_record/transactions.rb:237:in `block (2 levels) in save'
activerecord (3.0.1) lib/active_record/transactions.rb:289:in `block in with_transaction_returning_status'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.1) lib/active_record/transactions.rb:204:in `transaction'
activerecord (3.0.1) lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
activerecord (3.0.1) lib/active_record/transactions.rb:237:in `block in save'
activerecord (3.0.1) lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
activerecord (3.0.1) lib/active_record/transactions.rb:236:in `save'
activerecord (3.0.1) lib/active_record/base.rb:498:in `create'
app/models/project.rb:70:in `make_project_owner'
activesupport (3.0.1) lib/active_support/callbacks.rb:463:in `_run_create_callbacks'
activerecord (3.0.1) lib/active_record/callbacks.rb:281:in `create'
activerecord (3.0.1) lib/active_record/persistence.rb:247:in `create_or_update'
activerecord (3.0.1) lib/active_record/callbacks.rb:277:in `block in create_or_update'
activesupport (3.0.1) lib/active_support/callbacks.rb:428:in `_run_save_callbacks'
activerecord (3.0.1) lib/active_record/callbacks.rb:277:in `create_or_update'
activerecord (3.0.1) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.1) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.1) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.1) lib/active_record/transactions.rb:237:in `block (2 levels) in save'
activerecord (3.0.1) lib/active_record/transactions.rb:289:in `block in with_transaction_returning_status'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.1) lib/active_record/transactions.rb:204:in `transaction'
activerecord (3.0.1) lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
activerecord (3.0.1) lib/active_record/transactions.rb:237:in `block in save'
activerecord (3.0.1) lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
activerecord (3.0.1) lib/active_record/transactions.rb:236:in `save'
app/controllers/projects_controller.rb:34:in `create'
actionpack (3.0.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.1) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.1) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.1) lib/active_support/callbacks.rb:460:in `_run__2176748434120211400__process_action__1031157339911956458__callbacks'
activesupport (3.0.1) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.1) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.1) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.1) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.1) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.1) lib/action_controller/metal.rb:133:in `dispatch'
actionpack (3.0.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.1) lib/action_controller/metal.rb:173:in `block in action'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:492:in `call'
haml (3.0.24) lib/sass/plugin/rack.rb:41:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/cookies.rb:287:in `call'
activerecord (3.0.1) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.1) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.1) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.1) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.1) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.1) lib/rails/application.rb:168:in `call'
railties (3.0.1) lib/rails/application.rb:77:in `method_missing'
railties (3.0.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/home/pratik/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/pratik/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/pratik/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
I had a similar problem, but i was able to solve this with the following code:
module Connection
class DB1 < ActiveRecord::Base
self.abstract_class = true
establish_connection(Rails.env)
end
class DB2 < ActiveRecord::Base
self.abstract_class = true
establish_connection("#{Rails.env}_db2")
end
end
class Project < Connection::DB1
Maybe it worked for me because of the usages of establish_connection in all models.
I don't have time to test this so I cannot say for sure, but this line looks suspect to me:
self.calendars.create(:name => "default")
I would think it should be like this:
Calendar.create(:name => "default", :project_id => self.id)

Resources