Sha256: a38a68a2f548ce14992e2a1fd4e079d251904b14ebe75b5f75178ebbf653739f

Contents?: true

Size: 877 Bytes

Versions: 6

Compression:

Stored size: 877 Bytes

Contents

module ClosureTree
  module SupportFlags

    def use_attr_accessible?
      defined?(ActiveModel::MassAssignmentSecurity) &&
        model_class.respond_to?(:accessible_attributes) &&
        ! model_class.accessible_attributes.empty?
    end

    def include_forbidden_attributes_protection?
      defined?(ActiveModel::ForbiddenAttributesProtection) &&
        model_class.ancestors.include?(ActiveModel::ForbiddenAttributesProtection)
    end

    def order_option?
      order_by.present?
    end

    def order_is_numeric?
      options[:numeric_order]
    end

    def subclass?
      model_class != model_class.base_class
    end

    def has_inheritance_column?(hash = columns_hash)
      hash.with_indifferent_access.include?(model_class.inheritance_column)
    end

    def has_name?
      model_class.new.attributes.include? options[:name_column]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
closure_tree-7.4.0 lib/closure_tree/support_flags.rb
closure_tree-7.4.0.rc1 lib/closure_tree/support_flags.rb
closure_tree-7.3.0 lib/closure_tree/support_flags.rb
closure_tree-7.2.0 lib/closure_tree/support_flags.rb
closure_tree-7.1.0 lib/closure_tree/support_flags.rb
closure_tree-7.0.0 lib/closure_tree/support_flags.rb