Method: ActiveRecord::Extensions::CreateAndUpdate#save_with_extension
- Defined in:
- lib/ar-extensions/create_and_update.rb
#save_with_extension(options = {}) ⇒ Object
:nodoc:
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/ar-extensions/create_and_update.rb', line 195 def save_with_extension(={})#:nodoc: #invoke save_with_validation if the argument is not a hash return save_without_extension() if !.is_a?(Hash) return save_without_extension unless .any? perform_validation = .delete(:perform_validation) raise_exception = .delete(:raise_exception) if (perform_validation.is_a?(FalseClass)) || valid? raise ActiveRecord::ReadOnlyRecord if readonly? create_or_update() else raise ActiveRecord::RecordInvalid.new(self) if raise_exception false end end |