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



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

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

.build(klass, params = nil) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/generators/sequel.rb', line 46

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

.find(klass, params = nil) ⇒ Object



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

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

Instance Method Details

#destroyObject



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

def destroy
  "#{name}.destroy"
end

#errorsObject



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

def errors
  "#{name}.errors"
end

#saveObject



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

def save
  "#{name}.save"
end

#update_attributes(params = nil) ⇒ Object



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

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