Christiaan Van den Poel
2010-Sep-09 19:16 UTC
Rails3: jquery-rails gem sets ''config.action_view.javascript_expansions'' but cannot be overriden in ''config/application.rb''
Hello, I''ve created a new Rails3 app and I''m using jQuery instead of prototype. Gemfile: gem ''jquery-rails'' in my config/application.rb I want do the following: config/application.rb if Rails.env.production? config.action_view.javascript_expansions[:defaults] = %w(jquery.min rails application) else config.action_view.javascript_expansions[:defaults] = %w(jquery rails application) end So in production I want to include jquery.min whereas in development I want the unminified (jquery). But this seems not to work and when I look at the jquery-rails railtie, I see the following code: module Jquery module Rails class Railtie < ::Rails::Railtie config.before_initialize do if ::Rails.root.join("public/javascripts/jquery-ui.min.js").exist? config.action_view.javascript_expansions[:defaults] %w(jquery.min jquery-ui.min rails) else config.action_view.javascript_expansions[:defaults] %w(jquery.min rails) end end end end end This sets the config.action_view.javascript_expansions[:defaults] to always use jquery.min. So it seems to me that the code from my app (config/application.rb) isn''t applied. Although this should be possible to do. Is this expected behavior? Shouldn''t it be possible to override the expansions in your own application? TIA C+++ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Apparently Analagous Threads
- trouble using jQuery in Rails 3.0.7
- Rails3: render_to_string of a .html.erb when request is a json request raises MissingTemplate error
- observe_field for jquery + rails3
- The Rails3 way for in-place editing
- Authlogic + Rails3 - undefined method `Login' for nil:NilClass