You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a js.erb assets and used url_for method in it. In order to get url_for working, I included:
<% environment.context_class.instance_eval { include ActionView::Helpers } %>
<% environment.context_class.instance_eval { include ActionDispatch::Routing } %>
<% environment.context_class.instance_eval { include Rails.application.routes.url_helpers } %>
at the top of the js.erb file, everything worked fine in development mode, and url_for method translated well into the url I need. But when I precompile assets, rails shows me
rake aborted!
No route matches {:controller=>"external", :action=>"register_event"}
(in /Users/daiwei/localhost/_projects/the-project-cube/app/assets/javascripts/_homepage_event_form.js.erb)
/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:533:in `raise_routing_error'/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:529:in `rescue in generate'/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:521:in `generate'/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:562:in `generate'
/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:587:in `url_for'/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/url_for.rb:148:in `url_for'/Users/daiwei/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_view/helpers/url_helper.rb:107:in `url_for'/Users/daiwei/localhost/_projects/the-project-cube/app/assets/javascripts/_homepage_event_form.js.erb:69:in `evaluate_source'
.....
Routes should be fine, because everything worked fine everywhere else, even in live compile with production mode. The error only occurs in precompiling.
The text was updated successfully, but these errors were encountered:
Did you disable loading the app on asset precompile? If so you won't have controllers loaded. This looks more like a stack overflow question than a bug report.
Rails: 3.2.11
Ruby: 1.9.3p374
I created a js.erb assets and used url_for method in it. In order to get url_for working, I included:
at the top of the js.erb file, everything worked fine in development mode, and url_for method translated well into the url I need. But when I precompile assets, rails shows me
This is what I had for js.erb:69
Routes should be fine, because everything worked fine everywhere else, even in live compile with production mode. The error only occurs in precompiling.
The text was updated successfully, but these errors were encountered: