Sha256: fe0cb5fbbb2dafbbf0a6f5bcb055935797f6136935b56733b073b84f399a9ed7

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

require 'impartial/base'
require 'impartial-rails/helper'

module Impartial
  class Base

    protected

    def model(object_or_id, model_class)
      object_or_id.kind_of?(model_class) ? object_or_id : model_class.find(object_or_id.to_s)
    end

    def config
      return ::ActionController::Base.config
    end

    def url_options
      {}
    end

    def form_authenticity_token
      params[request_forgery_protection_token]
    end

    def protect_against_forgery?
      true
    end
  end
end

# Add to ActionController
ActionController::Base.class_eval do
  include ::Impartial::Rails::Helper
end

# Add to ActionView
ActionView::Base.class_eval do
  include ::Impartial::Rails::Helper
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
impartial-rails-0.0.4 lib/impartial-rails/rails.rb
impartial-rails-0.0.2 lib/impartial-rails/rails.rb
impartial-rails-0.0.1 lib/impartial-rails/rails.rb