Sha256: 4b482e9044b008264700445b001ce7188a047a3b9292b0e0f1b342abce3c94c0
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
# Configure Rails 3.0 to use form.js and remotipart module Remotipart module Rails class Railtie < ::Rails::Railtie config.before_configuration do # Files to be added to :defaults FILES = ['jquery.form', 'jquery.remotipart'] # Figure out where rails.js (aka jquery_ujs.js if install by jquery-rails gem) is # in the :defaults array position = config.action_view.javascript_expansions[:defaults].index('rails') || config.action_view.javascript_expansions[:defaults].index('jquery_ujs') # Merge form.js and then remotipart into :defaults array right after rails.js if position && position > 0 config.action_view.javascript_expansions[:defaults].insert(position + 1, *FILES) # If rails.js couldn't be found, it may have a custom filename, or not be in the :defaults. # In that case, just try adding to the end of the :defaults array. else config.action_view.javascript_expansions[:defaults].push(*FILES) end end initializer "remotipart.view_helper" do ActionView::Base.send :include, RequestHelper ActionView::Base.send :include, ViewHelper end initializer "remotipart.controller_helper" do ActionController::Base.send :include, RequestHelper end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
remotipart-0.4.2 | lib/remotipart/rails/railtie.rb |
remotipart-0.4.1 | lib/remotipart/rails/railtie.rb |
remotipart-0.4 | lib/remotipart/rails/railtie.rb |