Class: Mongoid::Orderable::Generators::Scope

Inherits:
Base
  • Object
show all
Defined in:
lib/mongoid/orderable/generators/scope.rb

Instance Attribute Summary

Attributes inherited from Base

#klass

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Mongoid::Orderable::Generators::Base

Instance Method Details

#generate(field_name, order_scope) ⇒ Object



7
8
9
10
11
12
# File 'lib/mongoid/orderable/generators/scope.rb', line 7

def generate(field_name, order_scope)
  criteria = criteria(order_scope)
  klass.class_eval do
    scope "orderable_#{field_name}_scope", criteria
  end
end