Module: CleanModel::Persistent::ClassMethods

Defined in:
lib/clean_model/persistent.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/clean_model/persistent.rb', line 15

def create(attributes={})
  begin
    create! attributes
  rescue
    nil
  end
end

#create!(attributes = {}) ⇒ Object



23
24
25
26
27
# File 'lib/clean_model/persistent.rb', line 23

def create!(attributes={})
  model = new attributes
  model.save!
  model
end