Class: DataMapper::Generators::ActiveModel
- Inherits:
-
Rails::Generators::ActiveModel
- Object
- Rails::Generators::ActiveModel
- DataMapper::Generators::ActiveModel
- Defined in:
- lib/generators/data_mapper.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.all(klass) ⇒ Object
39 40 41 |
# File 'lib/generators/data_mapper.rb', line 39 def self.all(klass) "#{klass}.all" end |
.build(klass, params = nil) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/generators/data_mapper.rb', line 47 def self.build(klass, params=nil) if params "#{klass}.new(#{params})" else "#{klass}.new" end end |
.find(klass, params = nil) ⇒ Object
43 44 45 |
# File 'lib/generators/data_mapper.rb', line 43 def self.find(klass, params=nil) "#{klass}.get(#{params})" end |
Instance Method Details
#destroy ⇒ Object
67 68 69 |
# File 'lib/generators/data_mapper.rb', line 67 def destroy "#{name}.destroy" end |
#errors ⇒ Object
63 64 65 |
# File 'lib/generators/data_mapper.rb', line 63 def errors "#{name}.errors" end |
#save ⇒ Object
55 56 57 |
# File 'lib/generators/data_mapper.rb', line 55 def save "#{name}.save" end |
#update_attributes(params = nil) ⇒ Object
59 60 61 |
# File 'lib/generators/data_mapper.rb', line 59 def update_attributes(params=nil) "#{name}.update(#{params})" end |