Class: ActiveGraph::Generators::ActiveModel

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object



2
3
4
# File 'lib/active_graph/generators/active_model.rb', line 2

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

.build(klass, params = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/active_graph/generators/active_model.rb', line 10

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

.find(klass, params = nil) ⇒ Object



6
7
8
# File 'lib/active_graph/generators/active_model.rb', line 6

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

Instance Method Details

#destroyObject



30
31
32
# File 'lib/active_graph/generators/active_model.rb', line 30

def destroy
  "#{name}.destroy"
end

#errorsObject



26
27
28
# File 'lib/active_graph/generators/active_model.rb', line 26

def errors
  "#{name}.errors"
end

#saveObject



18
19
20
# File 'lib/active_graph/generators/active_model.rb', line 18

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



22
23
24
# File 'lib/active_graph/generators/active_model.rb', line 22

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