RAILS 2.3.14 Defaults #230

Closed
d3vkit opened this Issue Dec 17, 2011 · 3 comments

Projects

None yet

3 participants

@d3vkit
d3vkit commented Dec 17, 2011

I ran into trouble trying to implement jquery and rails.js as defaults in my app (I am upgrading from 2.1 to 2.3.14 and then eventually to 3.1).

At the bottom of the jquery ujs page, it has:

config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

Which after some searching appears to be Rails 3 only. This works for rails 2.3 - put it in config/initializers/js_defaults.rb (or any name you choose):

module ActionView::Helpers::AssetTagHelper
  remove_const :JAVASCRIPT_DEFAULT_SOURCES
  JAVASCRIPT_DEFAULT_SOURCES = %w(jquery.js rails.js)

  reset_javascript_include_default
end

I've never submitted anything to github (issues or otherwise) so hopefully I have done this correctly. I believe the documentation for jquery-ujs should be updated to reflect this; it took me a while to find out how to get it to load these defaults.

@indirect
Member

I would suggest just using jquery-rails instead of doing it by hand.

On Dec 16, 2011, at 4:55 PM, d3vkitreply@reply.github.com wrote:

I ran into trouble trying to implement jquery and rails.js as defaults in my app (I am upgrading from 2.1 to 2.3.14 and then eventually to 3.1).

At the bottom of the jquery ujs page, it has:
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

Which after some searching appears to be Rails 3 only. This works for rails 2.3 - put it in config/initializers/js_defaults.rb (or any name you choose):
module ActionView::Helpers::AssetTagHelper
remove_const :JAVASCRIPT_DEFAULT_SOURCES
JAVASCRIPT_DEFAULT_SOURCES = %w(jquery.js rails.js)

 reset_javascript_include_default

end

I've never submitted anything to github (issues or otherwise) so hopefully I have done this correctly. I believe the documentation for jquery-ujs should be updated to reflect this; it took me a while to find out how to get it to load these defaults.


Reply to this email directly or view it on GitHub:
#230

@d3vkit
d3vkit commented Dec 17, 2011

Oh, then I am confused in reading the documentation - I assumed that the manual installation had to be done for rails 2.x, since it specifically mentioned it there. Sorry.

@JangoSteve
Member

@d3vkit Sorry about that, you are right. That was a result of some refactoring of the README a while ago. I updated it with the correct instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment