Class: Mongoid::Generators::ActiveModel

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object



25
26
27
# File 'lib/rails/generators/mongoid_generator.rb', line 25

def self.all(klass)
  "#{klass}.all"
end

.build(klass, params = nil) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/rails/generators/mongoid_generator.rb', line 33

def self.build(klass, params=nil)
  if params
    "#{klass}.new(#{params})"
  else
    "#{klass}.new"
  end
end

.find(klass, params = nil) ⇒ Object



29
30
31
# File 'lib/rails/generators/mongoid_generator.rb', line 29

def self.find(klass, params=nil)
  "#{klass}.find(#{params})"
end

Instance Method Details

#destroyObject



53
54
55
# File 'lib/rails/generators/mongoid_generator.rb', line 53

def destroy
  "#{name}.destroy"
end

#errorsObject



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

def errors
  "#{name}.errors"
end

#saveObject



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

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



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

def update_attributes(params=nil)
  "#{name}.update_attributes(#{params})"
end