Class: Mongoid::Generators::ActiveModel

Inherits:
Rails::Generators::ActiveModel
  • Object
show all
Defined in:
lib/rails/generators/mongoid_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#deleteObject



44
45
46
# File 'lib/rails/generators/mongoid_generator.rb', line 44

def delete
  "#{name}.delete"
end

#destroyObject



48
49
50
# File 'lib/rails/generators/mongoid_generator.rb', line 48

def destroy
  "#{name}.destroy"
end

#errorsObject



40
41
42
# File 'lib/rails/generators/mongoid_generator.rb', line 40

def errors
  "#{name}.errors"
end

#saveObject



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