2

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?

Bill
  • 131
  • 1
  • 1
  • 6

1 Answers1

0

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

Philip Hallstrom
  • 19,673
  • 2
  • 42
  • 46