Class: Mongoid::Generators::ActiveModel
- Inherits:
-
Rails::Generators::ActiveModel
- Object
- Rails::Generators::ActiveModel
- Mongoid::Generators::ActiveModel
- Defined in:
- lib/rails/generators/mongoid_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #destroy ⇒ Object
- #errors ⇒ Object
- #save ⇒ Object
- #update_attributes(params = nil) ⇒ Object
Class Method Details
.all(klass) ⇒ Object
16 17 18 |
# File 'lib/rails/generators/mongoid_generator.rb', line 16 def self.all(klass) "#{klass}.all" end |
.build(klass, params = nil) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rails/generators/mongoid_generator.rb', line 24 def self.build(klass, params=nil) if params "#{klass}.new(#{params})" else "#{klass}.new" end end |
.find(klass, params = nil) ⇒ Object
20 21 22 |
# File 'lib/rails/generators/mongoid_generator.rb', line 20 def self.find(klass, params=nil) "#{klass}.find(#{params})" end |
Instance Method Details
#delete ⇒ Object
44 45 46 |
# File 'lib/rails/generators/mongoid_generator.rb', line 44 def delete "#{name}.delete" end |
#destroy ⇒ Object
48 49 50 |
# File 'lib/rails/generators/mongoid_generator.rb', line 48 def destroy "#{name}.destroy" end |
#errors ⇒ Object
40 41 42 |
# File 'lib/rails/generators/mongoid_generator.rb', line 40 def errors "#{name}.errors" end |
#save ⇒ Object
32 33 34 |
# File 'lib/rails/generators/mongoid_generator.rb', line 32 def save "#{name}.save" end |
#update_attributes(params = nil) ⇒ Object
36 37 38 |
# File 'lib/rails/generators/mongoid_generator.rb', line 36 def update_attributes(params=nil) "#{name}.update_attributes(#{params})" end |