Include javascript on specific pages using Rails 3 -


I created service using Ajax and Rails for Jizz Chat, where I request the AXX server and I get feedback. Anyway, I want Ajax script to work on every page except Home / Chat, I have a chat.js file and I like this application.html like follow:

  Online Mental Health = Stylesheet_Link_tags include 'app' ,: media = & gt; "All" = csrf_meta_tags = javascript_include_tag 'application' - as long as the consultation [: controller] == 'home' = javascript_include_tag 'chat.js'  

In addition, I staging.rb and production Added .rb to:

  config.assets.precompile +% w (chat.js)  

and I included my chat.js file In Application.js

But when I deploy my application on the server, and

  RAILS_ENV = staging bundle xx rake property: precompile  

An error is occurring as Bellow:

  Spochet :: Help :: Rail: Helper :: Assetpath :: Error in the AssetPreCampined Dashboard # User_View chat.js precompiled Extracted Source (Approx. # 10): 7: / = Render 'shared / chat_javascript_include' 8: = javascript_include_tag 'application' 9: - when The ultimate [: controller] == 'home' 10: = javascript_include_tag 'chat.js' 11: body12: = 'render form_orange / header' 13: - If present_ger.  

Any help is appreciated. Thanks

I comment as a post for any one

Please do so in your environment file ( staging.rb , production.rb )

config.assets.compile = true


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -