Using Angular ng-src in Rails Production

I am creating a simple AngularJS application in Rails - when compiling in Heroku / production - ng-src binds to the correct path, but does not create standard thumbnails even if they are used with Rails <% image_tag%> so I just get 404 error only on the images "ng-src". The following is a simple angular code that I reference in Rails (I have no problems with concurrent CoffeeScript files). Everything works in production, but ng-src, which throws 404s. Is there a way to combine erb and ng-src to make this work in production? Of course, locally this is not a problem. I also searched for this, but did not find permission.

<div ng-controller="IndexCtrl">
<div class="left" ng-repeat="skill in skills | filter:query | orderBy:orderProp">
<div class="thumbnail">
   <img ng-src='/assets/logos/{{skill.shortname}}_s.png' alt="{{skill.alt}}" />
   <p>{{skill.description}}</p>
</div>
</div>
</div>
+4
source share
1 answer

The problem was providing access to static files, not RoR or angularJS. According to the OP, the solution is to configure in a file config/environments/production.rb:

config.serve_static_assets = true 
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' 
config.assets.compile = true 
+1
source

All Articles