I have a custom rake task and I am using a mailer with this task. I have an agent table with all of an agent's info. I also have an agent_card table that houses all of their license data. The agent_card table also has an agent_id column to identify which card goes with which agent. When trying to run the rake task and send out the mailer, I keep getting "ActionView::Template::Error: undefined method `name' for nil:NilClass." I can't figure out how to get the name, email, and phone through the agent_card table. I have included all the code below. Please and thank you!
Error:
rake aborted!
ActionView::Template::Error: undefined method `name' for nil:NilClass
/Users/michaelwiesenhart/Code/app/views/license_expire_mailer/license_expi re_mgr.html.erb:7:in `_app_views_license_expire_mailer_license_expire_mgr_html_erb___944550213720770297_70323524541360'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/template.rb:145:in `block in render'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/template.rb:333:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/template.rb:143:in `render'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:14:in `render'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/renderer.rb:46:in `render_template'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/renderer/renderer.rb:27:in `render'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/rendering.rb:100:in `_render_template'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/rendering.rb:83:in `render_to_body'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionpack-4.2.6/lib/abstract_controller/rendering.rb:25:in `render'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:904:in `block in collect_responses'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:918:in `each'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:918:in `each_template'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:900:in `collect_responses'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:829:in `mail'
/Users/michaelwiesenhart/Code/app/mailers/license_expire_mailer.rb:14:in `license_expire_mgr'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in `process'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in `process'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:596:in `block in process'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:593:in `process'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:584:in `initialize'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:25:in `new'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:34:in `message'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
/Users/michaelwiesenhart/Code/lib/tasks/license_expiration.rake:17:in `block (3 levels) in <top (required)>'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#global/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
/Users/michaelwiesenhart/Code/lib/tasks/license_expiration.rake:15:in `block (2 levels) in <top (required)>'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#/bin/ruby_executable_hooks:15:in `eval'
/Users/michaelwiesenhart/.rvm/gems/ruby-2.3.1#/bin/ruby_executable_hooks:15:in `<main>'
Agent Model:
has_one :agent_card
AgentCard Model:
belongs_to :agent
license_expire_mgr.html.erb
Hiya, <br><br>
The agent listed below has a license that will expire one week from today. Please make sure they renew before it expires!<br><br>
<strong>Name:</strong> <%= #agent.name %><br>
<strong>Phone:</strong> <%= #agent.phone %><br>
<strong>Email:</strong> <%= #agent.email %><br><br>
license_expire_mailer.rb
class LicenseExpireMailer < ActionMailer::Base
default from: "Mike <help#mike.com>"
def license_expire_mgr(agent_card, agent)
#agent_cards = agent_card
#agent = agent
mail to: "mike#mike.com", subject: "Agent License Expiring"
end
end
#agent is not being passed through to the mailer or the value of it is being evaluated as nil.
The problem is not with your rake task or your mailer, figure out why the param is nil and that will solve your problem.
I figured it out. I was trying to use agent_card and didn't need it. Once I removed it, it works just fine!
Related
I'm currently in the middle of upgrading a Ruby on Rails 3 project to Ruby on Rails 4.0.
Several of my tests related to controllers are failing because specific files cannot be found when rendering the templates during the tests:
ActionView::Template::Error: No such file or directory
All these errors have the same in common, that they try to load files from the tmp/cache in the Rails application. This was working all fine under Rails 3.
Is something specific required for asset compilation under Rails 4 in tests?
# config/application.rb
# Enable the asset pipeline
config.assets.enabled = true
The above is not overwritten in our test environment, so I assume this remains enabled? And we used Sprockets in Rails 3 as well.
Rails : 4.0
Sprockets : 3.6
I'm probably missing something obvious, just can't find it...
Error output
test_0001_should show a form to upload attachments and display existing ones(AttachmentsControllerTest::#new):
ActionView::Template::Error: No such file or directory # rb_sysopen - /root/my_app/tmp/cache/assets/test/sprockets/v3.0/m7/m7YIr0duEvKhRldOP5LjpABJF7kd9H6aT5dCMyGnOl8.cache.47262198725000.3291.4516
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:278:in `initialize'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:278:in `open'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:278:in `atomic_write'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/cache/file_store.rb:107:in `set'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/cache.rb:212:in `set'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/cache.rb:86:in `fetch'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:56:in `file_digest'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/unloaded_asset.rb:104:in `dependency_history_key'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:304:in `fetch_asset_from_dependency_cache'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `yield'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/environment.rb:30:in `find_asset'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:92:in `[]'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/helper.rb:123:in `asset_digest_path'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/helper.rb:76:in `compute_asset_path'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/asset_url_helper.rb:132:in `asset_path'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/helper.rb:91:in `asset_path'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/asset_url_helper.rb:234:in `javascript_path'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/asset_tag_helper.rb:58:in `block in javascript_include_tag'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/asset_tag_helper.rb:56:in `map'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/asset_tag_helper.rb:56:in `javascript_include_tag'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/helper.rb:148:in `javascript_include_tag'
/root/my_app/app/views/layouts/attachments.html.erb:2:in `block in _app_views_layouts_attachments_html_erb___457563631613762413_47262336759680'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/haml-4.0.7/lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/capture_helper.rb:38:in `capture'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/haml-4.0.7/lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/helpers/capture_helper.rb:152:in `content_for'
/root/my_app/app/views/layouts/attachments.html.erb:1:in `_app_views_layouts_attachments_html_erb___457563631613762413_47262336759680'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/template.rb:143:in `block in render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications.rb:159:in `block in instrument'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications.rb:159:in `instrument'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/template.rb:141:in `render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/renderer/template_renderer.rb:17:in `render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/renderer/renderer.rb:42:in `render_template'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_view/renderer/renderer.rb:23:in `render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/rendering.rb:127:in `_render_template'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/rendering.rb:120:in `render_to_body'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rendering.rb:33:in `render_to_body'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/renderers.rb:26:in `render_to_body'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/rendering.rb:97:in `render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rendering.rb:16:in `render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/local/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/core_ext/benchmark.rb:12:in `ms'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:41:in `block in render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:40:in `render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/base.rb:189:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:453:in `_run__64868443609262235__process_action__callbacks'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/callbacks.rb:80:in `run_callbacks'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications.rb:159:in `block in instrument'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications.rb:159:in `instrument'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/base.rb:136:in `process'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/abstract_controller/rendering.rb:44:in `process'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/test_case.rb:572:in `process'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/test_case.rb:64:in `process'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.9.5/lib/action_controller/serialization_test_case.rb:25:in `process'
/root/my_app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.13/lib/action_controller/test_case.rb:472:in `get'
/root/my_app/test/functional/attachments_controller_test.rb:78:in `block (2 levels) in <class:AttachmentsControllerTest>'
EDIT
This is the file causing the error: app/views/layouts/attachments.html.erb
<%= content_for :head do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
<%= render template: "layouts/standard_bootstrap" %>
The template is the following:
<!DOCTYPE html>
%html{lang: "en"}
%head
%script
= javascript_include_tag "/javascripts/jquery-ui-1.9.2.custom/js/jquery-1.8.3.js"
= javascript_include_tag "/javascripts/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js"
= stylesheet_link_tag "/javascripts/jquery-ui-1.9.2.custom/css/flick/jquery-ui-1.9.2.custom.min.css"
= stylesheet_link_tag 'standard'
= stylesheet_link_tag '/stylesheets/bootstrap/css/bootstrap.min.css'
= stylesheet_link_tag '/stylesheets/bootstrap/css/bootstrap-datepicker.standalone.min.css'
= javascript_include_tag "standard_bootstrap_third_party.js"
= yield :head
%body
#content
= yield
Could it be that it's not finding one of the files in the template?
All the referenced files exist in the /public/javascripts folder.
I had the exact same issue when using parallel_tests,
fixed by adding the following to config/environments/test.rb:
config.cache_store = :file_store, Rails.root.join("tmp", "cache", "paralleltests#{ENV['TEST_ENV_NUMBER']}")
as mentioned in parallel tests wiki
In my Ruby on Rails app I have the following partial patients/_patient_link.html.erb
<a class="patient" href="<%= patient_path(patient_link.id) %>">
<span class="name"><%= patient_link.name %></span>
</a>
I'm trying to render this partial from the console using the following code:
include Rails.application.routes.url_helpers
view = ActionView::Base.new('app/views/patients', {}, ActionController::Base.new)
output = view.render(file: '_patient_link.html', locals: {patient_link: User.last, current_user: User.last})
It returns me following error:
ActionView::Template::Error: wrong number of arguments (given 3, expected 0..1)
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/routing/url_for.rb:150:in `url_for'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:280:in `call'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:223:in `call'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:345:in `block (2 levels) in define_url_helper'
from /home/mateusz/projects/dashboard/app/views/patients/_patient_link.html.erb:1:in `_app_views_patients__patient_link_html_erb__1558238916296672676_82012840'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/template.rb:145:in `block in render'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/template.rb:333:in `instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/template.rb:143:in `render'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/template_renderer.rb:14:in `render'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/renderer.rb:46:in `render_template'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/renderer/renderer.rb:27:in `render'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/actionview-4.2.8/lib/action_view/helpers/rendering_helper.rb:32:in `render'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/haml-4.0.7/lib/haml/helpers/action_view_mods.rb:12:in `render_with_haml'
from (irb):5
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/mateusz/.rvm/gems/ruby-2.4.1/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
This href attribute inside partial is causing this error: href="<%= patient_path(patient_link.id) %>". How can I fix that?
I was able to make it work with following code:
ApplicationController.new.render_to_string(
:partial => 'patients/patient_link',
:locals => { :patient_link => User.last , current_user: User.first}
)
This is probably an easy fix, but my google fu has failed me.
Is there an easy way to find out from this which file has the encoding problem.
The application file has a meta tag for UTF-8
The application controller has a config.encoding ="utf-8"
I don't see any error in the browser. I'm seeing it from rake test.
1) Error:
StoreControllerTest#test_should_get_index:
ActionView::Template::Error: unknown encoding name - undecided
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:202:in `force_encoding'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:202:in `encode!'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:266:in `compile'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:244:in `block in compile!'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:232:in `synchronize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:232:in `compile!'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:144:in `block in render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `block in instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/template.rb:143:in `render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/template_renderer.rb:48:in `block (2 levels) in render_template'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `block in instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/template_renderer.rb:47:in `block in render_template'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/template_renderer.rb:55:in `render_with_layout'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/template_renderer.rb:46:in `render_template'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/template_renderer.rb:19:in `render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/renderer.rb:36:in `render_template'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_view/renderer/renderer.rb:17:in `render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/rendering.rb:110:in `_render_template'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/streaming.rb:225:in `_render_template'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/rendering.rb:103:in `render_to_body'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/rendering.rb:88:in `render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/rendering.rb:16:in `render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/core_ext/benchmark.rb:5:in `ms'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.14/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:39:in `render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/base.rb:167:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/rendering.rb:10:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:414:in `_run__996699002__process_action__630865188__callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/rescue.rb:29:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `block in instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `instrument'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.14/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/base.rb:121:in `process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/abstract_controller/rendering.rb:45:in `process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/test_case.rb:490:in `process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/test_case.rb:54:in `process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.14/lib/action_controller/test_case.rb:407:in `get'
/home/ubuntu/Documents/hartl/depot/test/functional/store_controller_test.rb:5:in `block in <class:StoreControllerTest>'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1265:in `run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit/testcase.rb:17:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:458:in `_run__884541456__setup__650240084__callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.14/lib/active_support/testing/setup_and_teardown.rb:35:in `run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:940:in `block in _run_suite'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:933:in `map'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:933:in `_run_suite'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:663:in `block in _run_suites'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:661:in `each'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:661:in `_run_suites'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:884:in `_run_anything'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1092:in `run_tests'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1079:in `block in _run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1078:in `each'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1078:in `_run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1066:in `run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:27:in `run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:780:in `run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:372:in `block (2 levels) in autorun'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:33:in `run_once'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit.rb:371:in `block in autorun'
Finished tests in 0.663328s, 12.0604 tests/s, 15.0755 assertions/s.
8 tests, 10 assertions, 0 failures, 1 errors, 0 skips
ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]
Errors running test:functionals! #<RuntimeError: Command failed with status (1): [ruby -I"lib:test" -I"/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib" "/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/functional/**/*_test.rb" ]>
There are a lot of rake tests failing in a ruby on rails project [1], all with same error (can't convert nil into String), and I don't have any idea why is this happening neither how I should debug it.
For example, this is the first tracebak of rake test (I have attached full rake test traceback at the end of the message [2]).
Error:
test_update(Admin::BazarDistrictsControllerTest):
TypeError: can't convert nil into String
/usr/lib/ruby/1.9.1/psych.rb:154:in `parse'
/usr/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
/usr/lib/ruby/1.9.1/psych.rb:125:in `parse'
/usr/lib/ruby/1.9.1/psych.rb:112:in `load'
/srv/www/gamersmafia/current/app/models/users_skill.rb:178:in `role_data_yaml'
/srv/www/gamersmafia/current/app/models/alert.rb:200:in `block in update_pending_alerts'
/srv/www/gamersmafia/current/app/models/alert.rb:198:in `each'
/srv/www/gamersmafia/current/app/models/alert.rb:198:in `update_pending_alerts'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/performable_method.rb:26:in `perform'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:37:in `block in enqueue'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:36:in `tap'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:36:in `enqueue'
/usr/lib/ruby/gems/1.9.1/gems/delayed_job-3.0.5/lib/delayed/message_sending.rb:13:in `method_missing'
/srv/www/gamersmafia/current/app/models/alert.rb:182:in `block in update_pending_alerts'
/srv/www/gamersmafia/current/app/models/alert.rb:180:in `each'
/srv/www/gamersmafia/current/app/models/alert.rb:180:in `update_pending_alerts'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:460:in `_run__1673722312823048322__save__808729243992924512__callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/callbacks.rb:264:in `create_or_update'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/persistence.rb:84:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/validations.rb:50:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:208:in `transaction'
/usr/lib/ruby/gems/1.9.1/gems/deadlock_retry-1.2.0/lib/deadlock_retry.rb:31:in `transaction_with_deadlock_handling'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:259:in `block in save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/transactions.rb:258:in `save'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/persistence.rb:45:in `create'
/srv/www/gamersmafia/current/app/models/bazar_district.rb:158:in `update_single_person_staff'
/srv/www/gamersmafia/current/app/models/bazar_district.rb:83:in `update_don'
/srv/www/gamersmafia/current/app/controllers/admin/bazar_districts_controller.rb:43:in `update'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:167:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:503:in `block in _run__1141341086633682237__process_action__2809844012775858444__callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_5310'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:233:in `block (2 levels) in gm_process'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:232:in `catch'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:232:in `block in gm_process'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/srv/www/gamersmafia/current/app/controllers/application_controller.rb:231:in `gm_process'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_5310'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:469:in `_run__1141341086633682237__process_action__2809844012775858444__callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `instrument'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:121:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:45:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:473:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:49:in `process'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_controller/test_case.rb:395:in `post'
/srv/www/gamersmafia/current/test/functional/admin/bazar_districts_controller_test.rb:42:in `block in <class:BazarDistrictsControllerTest>'
And I have more than 200 test with errors of a total of 1448 tests.
The question is, from where must I start to debug it? Why I'm getting same error in +90% of tests?
[1] https://github.com/gamersmafia/gamersmafia
[2] https://dl.dropbox.com/u/42306424/salida_rake.txt
In case of debugging. I reccomend to use gem 'pry-rails'.
Just bundle this gem and add 'binding.pry' to failing test. It will open console with all variables from your test, so you can manually check it. I hope it helps you to find out what's wrong.
It's might be one of the problems of Cucumber version.
You can fix this by upgrading cucumber-rails to a recent version. Just edit your Gemfile to show this:
gem 'cucumber-rails', '>= 1.1.1' or newer version
its solved my error when i got the same.
In your case, its pointed delayed_job gem
If you are using bundler try prefixing the script or rake task with "bundle exec" e.g.
bundle exec script/delayed_job -n 2 start
and Try!!!!
I've seemingly set up Devise for my User authentication, with the :confirmable option set.
Everything seems to run fine when I run it in the browser, I sign up, go to the confirmation url shown in the server log in my rails s console.
However, when I try to add the following to my db/seed.rb
User.create!(:username => 'haar', :email => 'haar#example.com', :password => 'password', :password_confirmation => 'password')
And run rake db:setup --trace
I get the following error:
rake aborted!
undefined method `confirmation_url' for #<#<Class:0x1062f79a0>:0x1062f6618>
/Users/haar/Dropbox/Websites/TenOutOfTen/app/views/devise/mailer/confirmation_instructions.html.haml:4:in `_app_views_devise_mailer_confirmation_instructions_html_haml___1737567023_2199377480_0'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_view/template.rb:135:in `send'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_view/template.rb:135:in `render'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/notifications.rb:54:in `instrument'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_view/template.rb:127:in `render'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_view/render/rendering.rb:59:in `_render_template'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/notifications.rb:52:in `instrument'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/notifications.rb:52:in `instrument'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_view/render/rendering.rb:56:in `_render_template'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/action_view/render/rendering.rb:26:in `render_without_haml'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/haml-3.1.3/lib/haml/helpers/action_view_mods.rb:13:in `render'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/rendering.rb:115:in `_render_template'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/rendering.rb:109:in `render_to_body'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/rendering.rb:102:in `render_to_string'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/rendering.rb:93:in `render'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/deprecated_api.rb:111:in `render'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:735:in `collect_responses_and_parts_order'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:750:in `each'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:750:in `each_template'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:745:in `each'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:745:in `each_template'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:731:in `collect_responses_and_parts_order'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:673:in `mail'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/devise-1.4.5/lib/devise/mailers/helpers.rb:21:in `devise_mail'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/devise-1.4.5/app/mailers/devise/mailer.rb:5:in `confirmation_instructions'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/base.rb:150:in `send_action'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/base.rb:150:in `process_action'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/base.rb:119:in `process'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.8/lib/abstract_controller/rendering.rb:41:in `process'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/old_api.rb:75:in `process'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:471:in `process'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:466:in `initialize'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:450:in `new'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-3.0.8/lib/action_mailer/base.rb:450:in `method_missing'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/devise-1.4.5/lib/devise/models/confirmable.rb:50:in `send_confirmation_instructions'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/callbacks.rb:423:in `_run_create_callbacks'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/callbacks.rb:277:in `create'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/persistence.rb:250:in `create_or_update'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/callbacks.rb:273:in `create_or_update'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/callbacks.rb:419:in `_run_save_callbacks'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/callbacks.rb:273:in `create_or_update'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/persistence.rb:60:in `save!'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/validations.rb:49:in `save!'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/transactions.rb:245:in `save!'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/transactions.rb:292:in `with_transaction_returning_status'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/transactions.rb:207:in `transaction'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/transactions.rb:245:in `save!'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/validations.rb:34:in `create!'
/Users/haar/Dropbox/Websites/TenOutOfTen/db/seeds.rb:7
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:235:in `load'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:235:in `load'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596:in `new_constants_in'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:235:in `load'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.8/lib/active_record/railties/databases.rake:281
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/haar/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/Users/haar/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.9.2/bin/rake:32
/Users/haar/.rvm/gems/ruby-1.8.7-p334/bin/rake:19:in `load'
/Users/haar/.rvm/gems/ruby-1.8.7-p334/bin/rake:19
Tasks: TOP => db:setup => db:seed
Any idea what's causing this and how to resolve it?
I have the following line included in my test environment, for the record:
config.action_mailer.default_url_options = { :host => "localhost:3000" }
Running on Ruby 1.8.7, Rails 3.0.8, with devise 1.4.5.
It simply turned out that when I ran rails generate devise:views, it generated incorrect paths when compared to the routes devise_for :user generated. It also generated some other issues, such as the user_confirmation_url pointing to #resource, as the first parameter; when it shouldn't have.
(I didn't want the question to be left unanswered, I'm unsure as to the typical etiquette. If I'm wrong in doing this, please let me know).
I also had the same issue just doing restart my server do the job for me and this error removed.
just do CTRL + c and then start your server using rails s
As an additional, if you're using STI with Devise models, as I am, you can check via the type attribute. So, my code looks like this:
<p><%= link_to 'Confirm my account', manager_confirmation_url(:confirmation_token => #resource.confirmation_token) if #resource.type == 'Manager' %></p>
<p><%= link_to 'Confirm my account', subscriber_confirmation_url(:confirmation_token => #resource.confirmation_token) if #resource.type == 'Subscriber' %></p>