Sha256: 79655e82aa462b2939024da62c0ecf1fc51607e88e9072b66900a8665864d73a

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

module MicroSessions
  module Helpers
    module UrlHelper
      extend ActiveSupport::Concern
    
      module InstanceMethods
        def url_for(options = {})
          if options.is_a?(Hash) && ms_value = options.delete(:micro_sessions) && !micro_session.empty?
            options[micro_session.options[:param]] = (ms_value == true ? micro_session.id : ms_value)
          end
        
          super
        end
      end
    end
    
    module FormTagHelper
      extend ActiveSupport::Concern
      
      module InstanceMethods
        def micro_session_hidden_field
          hidden_field_tag controller.class.micro_session_options[:param], micro_session.id
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
micro_sessions-0.1.1 lib/micro_sessions/helpers.rb
micro_sessions-0.1.0 lib/micro_sessions/helpers.rb