Class: Mongoid::Orderable::OrderableClass
- Inherits:
-
Object
- Object
- Mongoid::Orderable::OrderableClass
- Includes:
- Generator
- Defined in:
- lib/mongoid/orderable/orderable_class.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klass, configuration) ⇒ OrderableClass
constructor
A new instance of OrderableClass.
- #setup ⇒ Object
Methods included from Generator
#column_name, #generate_all_helpers, #order_scope
Methods included from Generator::Helpers
Methods included from Generator::Listable
Methods included from Generator::Movable
Methods included from Generator::Position
Methods included from Generator::Scope
Constructor Details
#initialize(klass, configuration) ⇒ OrderableClass
Returns a new instance of OrderableClass.
8 9 10 11 |
# File 'lib/mongoid/orderable/orderable_class.rb', line 8 def initialize(klass, configuration) @klass = klass @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
6 7 8 |
# File 'lib/mongoid/orderable/orderable_class.rb', line 6 def configuration @configuration end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
6 7 8 |
# File 'lib/mongoid/orderable/orderable_class.rb', line 6 def klass @klass end |
Class Method Details
.setup(klass, configuration = {}) ⇒ Object
21 22 23 |
# File 'lib/mongoid/orderable/orderable_class.rb', line 21 def self.setup(klass, configuration = {}) new(klass, configuration).setup end |
Instance Method Details
#setup ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mongoid/orderable/orderable_class.rb', line 13 def setup add_db_field add_db_index if configuration[:index] save_configuration generate_all_helpers add_callbacks end |