Sha256: 4cedde18214e344fb4e8cd9b66c75b6a4be42dfdca282100e3fdd25bcea81dba

Contents?: true

Size: 449 Bytes

Versions: 7

Compression:

Stored size: 449 Bytes

Contents

module Impressionist
  # Responsability
  # 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?
      ask_rails || false
    end

    private

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

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
impressionist-1.4.8 lib/impressionist/rails_toggle.rb
impressionist-1.4.7 lib/impressionist/rails_toggle.rb
impressionist-1.4.6 lib/impressionist/rails_toggle.rb
impressionist-1.4.5 lib/impressionist/rails_toggle.rb
impressionist-1.4.4 lib/impressionist/rails_toggle.rb
impressionist-1.4.3 lib/impressionist/rails_toggle.rb
impressionist-1.4.2 lib/impressionist/rails_toggle.rb