I am using ruby 1.8.7 and rails 2.3.5 and I am getting this weird message "Can't dup NilClass" when I try to run the code below
rr = Node.find(params[:id])
puts rr.inspect
rr.destroy
The application prints out the correct information about the node, when I try to do the exact same thing in script/console it works fine!!! I have no clue what is going on ..
I upgraded my application to rails 2.3.8 but no luck what so ever :(
Please help,
Edit:
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2184:in `dup'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2184:in `scoped_methods'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2188:in `current_scoped_methods'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2178:in `scope'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1543:in `find_every'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1505:in `find_initial'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:613:in `find'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/has_one_association.rb:80:in `find_target'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:239:in `load_target'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:112:in `reload'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1250:in `acl'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1460:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:1460:in `has_one_dependent_destroy_for_acl'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in `run'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `each'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `run'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:in `callback'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:336:in `destroy_without_transactions'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:in `transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:192:in `destroy'
/home/wael/public_html/app/models/node.rb:355:in `destroy'
Wa'el
Is it possibly somehow confusing your Node class with this one?
http://apidock.com/ruby/REXML/Node
Related
I have an application on heroku which uses mongoid and delayed_job and i have changed the ruby version from 1.9.2 to 1.9.3 I am getting an error
undefined method `match' for nil:NilClass
while I try to save an object to mongoid data base my mongoid.yaml file looks like
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
skip_version_check: true
safe: true
the trace is here
NoMethodError: undefined method `match' for nil:NilClass
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions/mongo_uri.rb:49:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions/factory.rb:103:in `new'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions/factory.rb:103:in `parse'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions/factory.rb:62:in `create_session'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions/factory.rb:43:in `default'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions.rb:109:in `default'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions.rb:378:in `__session__'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions.rb:213:in `mongo_session'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions.rb:157:in `collection'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/sessions.rb:25:in `collection'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence/operations.rb:27:in `collection'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence/operations/insert.rb:27:in `block in persist'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence/insertion.rb:25:in `block (2 levels) in prepare'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:403:in `_run__4034630009416245289__create__685777988298500290__callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
... 2 levels...
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:403:in `_run__4034630009416245289__save__685777988298500290__callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/callbacks.rb:114:in `run_callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence/insertion.rb:23:in `prepare'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence/operations/insert.rb:26:in `persist'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence.rb:50:in `insert'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.13/lib/mongoid/persistence.rb:79:in `save'
from (irb):2
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
any one can help me out? thanks in advance
The error is happening because the input parameter to this method https://github.com/mongoid/mongoid/blob/v3.0.13/lib/mongoid/sessions/mongo_uri.rb#L49 is nil.
Looking further back up the call stack to find out where this string comes from (see https://github.com/mongoid/mongoid/blob/v3.0.13/lib/mongoid/sessions/factory.rb#L103) it looks like your uri config param is nil. The uri key is present but empty, so can you check your MONGOHQ_URL configuration param by running heroku config. This should have been set by the MongoHQ addon.
The Ruby 1.9.1 paths in the stack trace are not anything to worry about. See Why Do Heroku Stack Traces indicate Ruby 1.9.1 is in use?
I am getting this issue while destroying an object.
NoMethodError: undefined method `substitute_at' for nil:NilClass
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/persistence.rb:135:in `destroy'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/locking/optimistic.rb:103:in `destroy'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/callbacks.rb:254:in `block in destroy'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:480:in `_run__348799253__destroy__466331341__callbacks'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/callbacks.rb:254:in `destroy'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/transactions.rb:254:in `block in destroy'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/activerecord-3.2.11/lib/active_record/transactions.rb:254:in `destroy'
from (irb):1
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p194#clu2/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
I have fixed the issue, My app's one of association name was connection which is reserved word in active record gem:
See line #135
https://github.com/rails/rails/blob/3-2-stable/activerecord/lib/active_record/persistence.rb
I changed the association name from connection to something else and everything is fine now.
I have find It is a rails issue https://github.com/rails/rails/pull/9371. I think it is fixed now. You can update you rails
I use delayed job to carry out background tasks in my app. It does some stuff and then sends a mail. This is an example of the code block preformed as a delayed job.
def task
# do stuff
AppMailer.post.some_template(#variable)
end
This has been working fine, I have a template in the correct directory some_template.text.plain.erb. I have started seeing this raise a MissingTemplate exception and this stops the delayed job and tries again after a given time (as expected when exceptions are raised in delayed job). Some cases this will fail 2 or 3 times and then deliver successfully, other cases there will be no exception raised. How can a template not exist then be found successfully upon the next attempt?
The error is looking for a template .erb is the plain.text.erb causing this problem. Any ideas why this is causing an intermittent problem? I have tried wrapping the sending of the mail in a rescue block as I would rather not send the mail than raise an exception.
def task
# do stuff
begin
AppMailer.post.some_template(#variable)
rescue ActionView::MissingTemplate => e
# do stuff
end
end
But the exception is still raised. Does delayed job do anything that might stop this rescue block working?
Here is the stack trace
Error:
Missing template app_mailer/some_template.erb in view path app/views:vendor/plugins/tolk/app/views
/data/app/shared/bundled_gems/ruby/1.8/gems/actionpack-2.3.14/lib/action_view/paths.rb:74:in `find_template'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionpack-2.3.14/lib/action_view/base.rb:264:in `render'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionmailer-2.3.14/lib/action_mailer/base.rb:600:in `render'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionmailer-2.3.14/lib/action_mailer/base.rb:586:in `render_message'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionmailer-2.3.14/lib/action_mailer/base.rb:526:in `create!'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionmailer-2.3.14/lib/action_mailer/base.rb:485:in `initialize'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionmailer-2.3.14/lib/action_mailer/base.rb:427:in `new'
/data/app/shared/bundled_gems/ruby/1.8/gems/actionmailer-2.3.14/lib/action_mailer/base.rb:427:in `method_missing'
/data/app/releases/20121127213524/app/models/mail_delivery.rb:55:in `send'
/data/app/releases/20121127213524/app/models/mail_delivery.rb:55:in `serialize_mail'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `send'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:93:in `run'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `each'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `send'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `run'
/data/app/shared/bundled_gems/ruby/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:276:in `run_callbacks'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:344:in `callback'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:265:in `create'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2927:in `create_or_update_without_callbacks'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:250:in `create_or_update'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2577:in `save_without_validation'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/validations.rb:1089:in `save_without_dirty'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/dirty.rb:79:in `save_without_transactions'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `send'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction_without_trace_ActiveRecord_self_name_transaction'
/data/app/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.4.0.1/lib/new_relic/agent/method_tracer.rb:491:in `transaction'
/data/app/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.4.0.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/data/app/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.4.0.1/lib/new_relic/agent/method_tracer.rb:486:in `transaction'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save'
/data/app/shared/bundled_gems/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:727:in `create'
/data/app/releases/20121127213524/app/models/mail_delivery.rb:88:in `method_missing'
/data/app/releases/20121127213524/lib/job_manifest.rb:670:in `notify_user_of_upload_without_audit'
/data/app/releases/20121127213524/lib/job_manifest.rb:6:in `send'
/data/app/releases/20121127213524/lib/job_manifest.rb:6:in `notify_user_of_upload_with_audit'
/data/app/releases/20121127213524/lib/job_manifests/app_send_job.rb:43:in `notify_user_of_upload'
/data/app/releases/20121127213524/lib/job_manifests/app_send_job.rb:43:in `extended'
/data/app/releases/20121127213524/lib/job_manifest.rb:102:in `preflight_completed_changed_delayed'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/performable_method.rb:35:in `send'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/performable_method.rb:35:in `perform'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/backend/base.rb:74:in `invoke_job'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:122:in `run'
/usr/lib64/ruby/1.8/timeout.rb:67:in `timeout'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:122:in `run'
/usr/lib64/ruby/1.8/benchmark.rb:308:in `realtime'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:121:in `run'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:173:in `reserve_and_run_one_job'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:106:in `work_off'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:105:in `times'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:105:in `work_off'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:80:in `start'
/usr/lib64/ruby/1.8/benchmark.rb:308:in `realtime'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:79:in `start'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:76:in `loop'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/worker.rb:76:in `start'
/data/app/shared/bundled_gems/ruby/1.8/gems/delayed_job-2.0.7/lib/delayed/command.rb:100:in `run'
(eval):1
/data/app/current/script/runner:3:in `eval'
/data/app/shared/bundled_gems/ruby/1.8/gems/rails-2.3.14/lib/commands/runner.rb:48
/data/app/current/script/runner:3:in `require'
/data/app/current/script/runner:3
I know there are a couple of problems here but any advice would be appreciated.
It's hard to say from just what you've posted but with Delayed Job Mailer errors I would typically check for two things:
That your workers are being restarted when you deploy new code, so that they are using the latest version of your app.
Are the arguments you're passing to the Mailer method used to retrieve records? If so be careful that records don't change or disappear between the job being created and the job being worked. Consider passing in exactly the attributes you need to build the mail if this is the case.
I've table tournaments with fields user_id,question_id,answer and I created key like
Primary key (user_id, question_id)
But when I want to change answer field like this:
t=Tournament.where('question_id=200').first
t.answer=2
t.save
I've got error:
NoMethodError: undefined method `eq' for nil:NilClass
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.4/lib/active_support/whiny_nil.rb:48:in `method_missing'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/persistence.rb:255:in `update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/locking/optimistic.rb:77:in `update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/attribute_methods/dirty.rb:68:in `update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/timestamp.rb:60:in `update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/callbacks.rb:285:in `block in update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:413:in `_run_update_callbacks'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/callbacks.rb:285:in `update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/persistence.rb:246:in `create_or_update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/callbacks.rb:277:in `block in create_or_update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:423:in `_run_save_callbacks'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/callbacks.rb:277:in `create_or_update'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/persistence.rb:56:in `save!'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/validations.rb:49:in `save!'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/transactions.rb:245:in `block in save!'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/transactions.rb:207:in `transaction'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.4/lib/active_record/transactions.rb:245:in `save!'
from (irb):4
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.4/lib/rails/commands/console.rb:44:in `start'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.4/lib/rails/commands/console.rb:8:in `start'
from /home/marat/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.4/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
Can anyone help me?
Thanks.
Did you modify your tables at all from a standard Rails genearated one?
if so, see undefined method `eq' for nil:NilClass with rails 3 and ruby enterprise on ubuntu hardy
I'm having problems with my functional tests involving paperclip and attachments. I'm using the fixture_file_upload method to fake the attachment uploads.
My tests intermittently give me the error below (or one similar to it), generated by a factory_girl call to create the object containing the attachment, which is in my setup block.
#asset = Factory(:asset, :item => fixture_file_upload('test.png','image/png'))
However, even though the setup block is run for every test in the final, this error isn't generated for every test. Running a single test in the file (which calls the setup block and the above method) runs fine. It's just with multiple tests that I get the error (and it's not always the same depending on how many tests are run.) So there's some sort of conflict with multiple calls to fixture_file_upload.
Anyone have any ideas of how to get around this problem? Thank you.
Errno::ENOENT: No such file or directory - /var/folders/cm/cmC3aPSEE7i3lzQGMwM2Kk+++TI/-Tmp-/stream,17938,0,17938,0
/Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/fileutils.rb:1407:in `stat'
/Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/fileutils.rb:1407:in `block in fu_each_src_dest'
/Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/fileutils.rb:1423:in `fu_each_src_dest0'
/Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/fileutils.rb:1405:in `fu_each_src_dest'
/Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/fileutils.rb:504:in `mv'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip/storage.rb:42:in `block in flush_writes'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip/storage.rb:38:in `each'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip/storage.rb:38:in `flush_writes'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip/attachment.rb:144:in `save'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip.rb:384:in `block in save_attached_files'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip.rb:377:in `block in each_attachment'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip.rb:376:in `each'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip.rb:376:in `each_attachment'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/paperclip-2.3.3/lib/paperclip.rb:383:in `save_attached_files'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activesupport-3.0.0.beta4/lib/active_support/callbacks.rb:429:in `_run_save_callbacks'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/callbacks.rb:290:in `create_or_update'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/persistence.rb:53:in `save!'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/validations.rb:46:in `save!'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/transactions.rb:240:in `block in save!'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/transactions.rb:287:in `block in with_transaction_returning_status'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/transactions.rb:202:in `transaction'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/transactions.rb:285:in `with_transaction_returning_status'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activerecord-3.0.0.beta4/lib/active_record/transactions.rb:240:in `save!'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/factory_girl-1.3.1/lib/factory_girl/proxy/create.rb:6:in `result'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/factory_girl-1.3.1/lib/factory_girl/factory.rb:326:in `run'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/factory_girl-1.3.1/lib/factory_girl/factory.rb:270:in `create'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/factory_girl-1.3.1/lib/factory_girl/factory.rb:301:in `default_strategy'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/factory_girl-1.3.1/lib/factory_girl.rb:20:in `Factory'
/Users/francis/dev/r3/works/test/functional/assets_controller_test.rb:13:in `block in <class:AssetsControllerTest>'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activesupport-3.0.0.beta4/lib/active_support/callbacks.rb:433:in `_run_setup_callbacks'
/Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/activesupport-3.0.0.beta4/lib/active_support/testing/setup_and_teardown.rb:34:in `run'
Looks like this issue: https://github.com/thoughtbot/paperclip/issues/270. There is a possible workaround in the article.