I am trying to use asset_pathRuby on Rails 4 through javascript during development in my application. In my javascript, I am referencing an HTML file using something like:
<%= asset_path('templates/login/index.html.erb') %>"
The file is physically located in $RAILS_ROOT/app/assets/templates/login/index.html.erb
When my javascript tries to capture this file, it will catch the “common” route that I put together because my interface is AngularJS and it handles the “routing” for the application. Here is the log:
Started GET "/templates/login/index.html.erb" for 127.0.0.1 at 2013-07-30 11:20:43 -0400
Processing by HomeController
Parameters: {"a"=>"templates/login/index.html"}
Rendered home/index.html.erb within layouts/application (0.0ms)
Completed 200 OK in 12ms (Views: 12.3ms | ActiveRecord: 0.0ms)
My .rb routes look like this:
App::Application.routes.draw do
devise_for :users
root :to => 'home#index'
namespace :api do
end
get '*a', to: 'home#index'
end
What is the best way to avoid this problem? How can I link to a template file in a javascript / angular project?
, , , . , , "", . , - Rails Angular, Rails 404.