Sha256: 42b936b1429cc5f760c356fd6cc00d067848e47a8c4befa518e3192c96cf0fd3

Contents?: true

Size: 559 Bytes

Versions: 15

Compression:

Stored size: 559 Bytes

Contents

module Impressionist
  # Responsibility
  # Toggles between rails > 3.1 < 4
  # In order to make attr_accessible available in a rails app < 4

  class RailsToggle
    # decides where or not to include attr_accessible
    def should_include?
      supported_by_rails? && (not using_strong_parameters?)
    end

    private

      def using_strong_parameters?
        defined?(StrongParameters)
      end

      # returns false if rails >= 4
      # true if rails < 4
      def supported_by_rails?
        ::Rails::VERSION::MAJOR.to_i < 4
      end

  end

end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
impressionist-cody-2.0.0 lib/impressionist/rails_toggle.rb
impressionist-2.0.0 lib/impressionist/rails_toggle.rb
impressionist-1.6.1 lib/impressionist/rails_toggle.rb
impressionist-1.6.0 lib/impressionist/rails_toggle.rb
impressionist-1.5.2 lib/impressionist/rails_toggle.rb
impressionist2-1.5.5 lib/impressionist/rails_toggle.rb
impressionist2-1.5.4 lib/impressionist/rails_toggle.rb
impressionist2-1.5.3 lib/impressionist/rails_toggle.rb
impressionist2-1.5.1 lib/impressionist/rails_toggle.rb
impressionist-1.5.1 lib/impressionist/rails_toggle.rb
impressionist-1.4.13 lib/impressionist/rails_toggle.rb
impressionist-1.4.12 lib/impressionist/rails_toggle.rb
impressionist-1.4.11 lib/impressionist/rails_toggle.rb
impressionist-1.4.10 lib/impressionist/rails_toggle.rb
impressionist-1.4.9 lib/impressionist/rails_toggle.rb