Class: Diametric::Generators::ActiveModel

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object


7
8
9
# File 'lib/diametric/generators/active_model.rb', line 7

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

.build(klass, params = nil) ⇒ Object


15
16
17
18
19
20
21
# File 'lib/diametric/generators/active_model.rb', line 15

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

.find(klass, params = nil, connection = nil, resolve = false) ⇒ Object


11
12
13
# File 'lib/diametric/generators/active_model.rb', line 11

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

Instance Method Details

#destroyObject


36
37
38
# File 'lib/diametric/generators/active_model.rb', line 36

def destroy
  "#{name}.destroy"
end

#errorsObject


32
33
34
# File 'lib/diametric/generators/active_model.rb', line 32

def errors
  "#{name}.errors"
end

#saveObject


23
24
25
# File 'lib/diametric/generators/active_model.rb', line 23

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object


27
28
29
30
# File 'lib/diametric/generators/active_model.rb', line 27

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