Sha256: 7a169cdac1be07c394e096565d3d5e0288e1c2f7cb4b3e62e502d557f31b5ec9

Contents?: true

Size: 747 Bytes

Versions: 6

Compression:

Stored size: 747 Bytes

Contents

module Fume
  module RailsExt
    
    def self.try_enable
      ActionController::Base.send :include, ControllerExtensions::InstanceMethods
      ActionController::Base.send :helper, RailsHelpers
    end
    
    module ControllerExtensions
      module InstanceMethods
        
        protected
        def redirect_to_ok_url_or_default(default)
          redirect_to params[:ok_url] || default
        end
      end
    end
    
    module RailsHelpers
      def public_path(source)
        url_for("#{ActionController::Base.relative_url_root}#{source}")
      end
      
      def translate_attribute(klass, attribute_name)
        klass.human_attribute_name(attribute_name)
      end

      alias :ta :translate_attribute
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fume-0.5.3 lib/fume/rails_ext.rb
fume-0.5.2 lib/fume/rails_ext.rb
fume-0.5.1 lib/fume/rails_ext.rb
fume-0.5.0 lib/fume/rails_ext.rb
fume-0.4.3 lib/fume/rails_ext.rb
fume-0.4.2 lib/fume/rails_ext.rb