I have a Rails application and an Engine.
When i have config.eager_load= true in my environments/production.rb the app crashes giving the following error in the engine
FATAL: ActionView::Template::Error(undefined local variable or method `current_user' for #<#<Class:0x00000005812fe0>:0x00000005811e88>)
/var/www/rack_apps/manager/shared/vendor_bundle/ruby/2.1.0/gems/authorization_engine-0.1.0.SNAPSHOT.20140407182910/app/views/authorization_engine/authorizations/new.html.haml:26:in `__var_www_rack_apps_manager_shared_vendor_bundle_ruby_______gems_authorization_engine_______________________________app_views_authorization_engine_authorizations_new_html_haml__268041456534634533_46121540'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/template.rb:143:in `block in render'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications.rb:161:in `instrument'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/template.rb:141:in `render'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications.rb:159:in `block in instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/notifications.rb:159:in `instrument'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/template_renderer.rb:17:in `render'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/renderer.rb:42:in `render_template'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_view/renderer/renderer.rb:23:in `render'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/abstract_controller/rendering.rb:127:in `_render_template'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_controller/metal/streaming.rb:219:in `_render_template'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/abstract_controller/rendering.rb:120:in `render_to_body'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_controller/metal/rendering.rb:33:in `render_to_body'
vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.4/lib/action_controller/metal/renderers.rb:26:in `render_to_body'
But the same above seems to work if i set the config.eager_load = false
Is this normal ? ... I know you shouldn't be setting eager_load to false in production. Is there a way not to eager load the engine or have i got the entire concept wrong ?
I know it says undefined variable current_user but it picks it up perfectly when i run locally . Any suggestions or ideas would be awesome .Thanks
http://edgeguides.rubyonrails.org/configuring.html
The official documentation says:
config.eager_load when true, eager loads all registered config.eager_load_namespaces. This includes your application, engines, Rails frameworks and any other registered namespace.
To answer that question correct we need to know what are you using for sessions, like devise gem or something. But I guess you use some gem for it and if you say that locally your application running without errors, so maybe there is difference in your gem versions locally and on server? You could update gem and it broke something for example. So I advise you to start with this.
Related
I'm encountering a weird error related to partials (happens in CI only). For some reason action view is not able to find a cached partial.
Things I've tried so far:
updating/downgrading gems
changing cache config in environments
checking if haml templates are valid
It seems to be pretty random, like a timing/caching issue. Any ideas how to narrow it down further?
#<ActionView::Template::Error: undefined method `_app_views_layouts__scripts_html_haml___2595795301995672650_69966270413140' for #<#<Class:0x00007f447a616578>:0x00007f4472804ab8>>
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/base.rb:274:in `_run'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/template.rb:185:in `block in render'
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:182:in `instrument'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/template.rb:385:in `instrument_render_template'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/template.rb:183:in `render'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/partial_renderer.rb:357:in `block in render_partial'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `block in instrument'
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `instrument'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/partial_renderer.rb:346:in `render_partial'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/partial_renderer.rb:317:in `render'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/renderer.rb:65:in `render_partial_to_object'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/renderer/renderer.rb:53:in `render_partial'
/usr/local/bundle/gems/actionview-6.0.3.4/lib/action_view/helpers/rendering_helper.rb:38:in `render'
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
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!
NameError (uninitialized constant Views::Setup::User):
app/views/setup/user.html.rb:1:in `_app_views_setup_user_html_rb___557294190_11042'
actionpack (3.1.12) lib/action_view/template.rb:144:in `render'
activesupport (3.1.12) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.12) lib/action_view/template.rb:142:in `render'
actionpack (3.1.12) lib/action_view/renderer/template_renderer.rb:40:in `render_template'
actionpack (3.1.12) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument'
activesupport (3.1.12) lib/active_support/notifications.rb:53:in `instrument'
activesupport (3.1.12) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.12) lib/active_support/notifications.rb:53:in `instrument'
...
parameters: {"controller"=>"setup", "action"=>"user"}
It appears as though, when running in development mode, the first pageload of a given page will succeed, then the second pageload will throw this uninitialized constant error, referencing the file where the constant (class) is defined...
Was working fine before in Rails 3.0.
Rails 3.1.12
JRuby 1.7.11
Erector 0.10.0
Appears to have been an issue between Rails 3.1 and the Erector gem.
For some reason or another, views named in the scheme "view_name.html.rb" aren't loaded properly after the first load. The same file named "view_name.rb" works fine.
This appears to no longer be the case upon bumping to Rails 3.2, so I assume it's a quirk in 3.1 not properly checking mime types when autoloading.
Sprockets::Environment#path is deprecated
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:119:in `rewrite_asset_path'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/asset_paths.rb:29:in `compute_public_path'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:100:in `compute_public_path'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:67:in `asset_path'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:57:in `block in stylesheet_link_tag'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:47:in `collect'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:47:in `stylesheet_link_tag'
/home/yulong/one/app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___567393440_92926490'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/template.rb:144:in `block in render'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/activesupport-3.1.0.rc6/lib/active_support/notifications.rb:55:in `instrument'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/template.rb:142:in `render'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/template_renderer.rb:52:in `render_with_layout'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/template_renderer.rb:38:in `render_template'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/template_renderer.rb:12:in `block in render'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/template_renderer.rb:9:in `render'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/renderer.rb:36:in `render_template'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_view/renderer/renderer.rb:17:in `render'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/abstract_controller/rendering.rb:120:in `_render_template'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_controller/metal/streaming.rb:250:in `_render_template'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/abstract_controller/rendering.rb:114:in `render_to_body'
/home/yulong/.rvm/gems/ruby-1.9.2-p290#rails31/gems/actionpack-3.1.0.rc6/lib/action_controller/metal/renderers.rb:30:in `render_to_body'
Else, when i install rails, I got an error "file 'lib' not found", but i can't solve it and i think it's relative.
These deprecations, recently introduced in Sprockets, warnings fixed in rails-3.1.0-rc7. See https://github.com/rails/rails/issues/2598 for more detail.
Upgrade to the latest Rails 3.1.rc8, or you can wait for Rails 3.1 final that should be released by tomorrow.