Class: DataMapper::Generators::ActiveModel

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object



35
36
37
# File 'lib/generators/data_mapper.rb', line 35

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

.build(klass, params = nil) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/generators/data_mapper.rb', line 43

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

.find(klass, params = nil) ⇒ Object



39
40
41
# File 'lib/generators/data_mapper.rb', line 39

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

Instance Method Details

#destroyObject



63
64
65
# File 'lib/generators/data_mapper.rb', line 63

def destroy
  "#{name}.destroy"
end

#errorsObject



59
60
61
# File 'lib/generators/data_mapper.rb', line 59

def errors
  "#{name}.errors"
end

#saveObject



51
52
53
# File 'lib/generators/data_mapper.rb', line 51

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



55
56
57
# File 'lib/generators/data_mapper.rb', line 55

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