Class: Sequel::Generators::ActiveModel

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all(klass) ⇒ Object



41
42
43
# File 'lib/generators/sequel.rb', line 41

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

.build(klass, params = nil) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/generators/sequel.rb', line 49

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

.find(klass, params = nil) ⇒ Object



45
46
47
# File 'lib/generators/sequel.rb', line 45

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

Instance Method Details

#destroyObject



69
70
71
# File 'lib/generators/sequel.rb', line 69

def destroy
  "#{name}.destroy"
end

#errorsObject



65
66
67
# File 'lib/generators/sequel.rb', line 65

def errors
  "#{name}.errors"
end

#saveObject



57
58
59
# File 'lib/generators/sequel.rb', line 57

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



61
62
63
# File 'lib/generators/sequel.rb', line 61

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