Class: Toystore::Generators::ActiveModel

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object



14
15
16
# File 'lib/generators/toystore.rb', line 14

def self.all(klass)
  "raise 'all is not supported'"
end

.build(klass, params = nil) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/generators/toystore.rb', line 22

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

.find(klass, params = nil) ⇒ Object



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

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

Instance Method Details

#destroyObject



42
43
44
# File 'lib/generators/toystore.rb', line 42

def destroy
  "#{name}.destroy"
end

#errorsObject



38
39
40
# File 'lib/generators/toystore.rb', line 38

def errors
  "#{name}.errors"
end

#saveObject



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

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



34
35
36
# File 'lib/generators/toystore.rb', line 34

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