So I have a view which basicaly loads in a given .js file and it works fine on local host but when i push it to heroku it dies.
basically in the controller i define
@script = '/assests/script_name.js?body=1'
and in the view i call
%script{:src => @script, :type => "text/javascript"}
and this loads the correct scripts in development but in production it can't find them
what am i missing?
In your controller...
@script = view_context.asset_path('script_name.js')
If it was me, I'd do this instead though:
controller: @script = 'script_name'
view: = javascript_include_tag @script
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.