Class: ActiveGraph::Generators::ActiveModel

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object



54
55
56
# File 'lib/rails/generators/migration_helper.rb', line 54

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

.build(klass, params = nil) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/rails/generators/migration_helper.rb', line 62

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

.find(klass, params = nil) ⇒ Object



58
59
60
# File 'lib/rails/generators/migration_helper.rb', line 58

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

Instance Method Details

#destroyObject



82
83
84
# File 'lib/rails/generators/migration_helper.rb', line 82

def destroy
  "#{name}.destroy"
end

#errorsObject



78
79
80
# File 'lib/rails/generators/migration_helper.rb', line 78

def errors
  "#{name}.errors"
end

#saveObject



70
71
72
# File 'lib/rails/generators/migration_helper.rb', line 70

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



74
75
76
# File 'lib/rails/generators/migration_helper.rb', line 74

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