Sha256: 19afb5347e118a659c8d644a147a5f691096638d58208881322e289a4bb5be63

Contents?: true

Size: 499 Bytes

Versions: 2

Compression:

Stored size: 499 Bytes

Contents

module Jacaranda 
  module ClassMethods

    private

      def create_scope_methods
        inclusion_validators.each do |v| 
          v.options[:in].each do |content|
            scope(build_scope_name(v.attributes.first, content), lambda { where("#{v.attributes.first} = ? ", "#{content}") })
          end
        end
      end

      def build_scope_name(column, name)
        if configuration[:scoped]
          "#{name}_#{column}"
        else
          name
        end
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jacaranda-0.0.2 lib/jacaranda/scope.rb
jacaranda-0.0.1 lib/jacaranda/scope.rb