javascript - Undefined local variable or method when I use <%= home_index_path %> in application.js.erb, why? -


as title states, have application.js.erb file looks following:

//= require jquery //= require jquery-ui //= require bootstrap //= require html5shiv //= require_tree .  $(document).ready(function(){    $("#opening-first").fadein(1000, function() {     $("#opening-second").fadein(1000, function() {         $("#opening-container").delay(500).fadeout(1000, function() {             $("#body-overlay").fadeout(1000);         });     });   });    $(".me").on('click', function(){     fadeandreload('<%= me_home_index_path %>');   });    $(".home").on('click', function(){     fadeandreload('<%= root_path %>');   });    function fadeandreload(filename) {     var body = $("#reload-me");     body.fadeout(500, function() {         body.load(filename, function() {         body.fadein(500);       });     });   } }); 

my routes listed as:

   home_index /home/index(.:format) home#index me_home_index /home/me(.:format)    home#me          root     /                     home#index 

i'm getting following error:

undefined local variable or method `me_home_index_path' #<#<class:0x007f99d63b5728>:0x007f99d65ef9d0>   (in /users/[filepathhere]/javascripts/application.js.erb) 

what problem??

for it's worth, had add line top of application.js.erb file under require statements, , works now:

<% environment.context_class.instance_eval { include rails.application.routes.url_ helpers } %> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -