class SmoothOperator::Rails

Public Class Methods

human_attribute_name(attribute_key_name, options = {}) click to toggle source
# File lib/smooth_operator.rb, line 45
def self.human_attribute_name(attribute_key_name, options = {})
  SmoothOperator::Translation::HelperMethods.translate(
    "attributes.#{model_name.i18n_key}.#{attribute_key_name}",
    options
  )
end
model_name() click to toggle source
# File lib/smooth_operator.rb, line 76
def self.model_name
  smooth_model_name
end

Public Instance Methods

after_save() click to toggle source
# File lib/smooth_operator.rb, line 74
def after_save; end
before_save() click to toggle source
# File lib/smooth_operator.rb, line 70
def before_save
  true
end
column_for_attribute(attribute_name) click to toggle source
# File lib/smooth_operator.rb, line 52
def column_for_attribute(attribute_name)
  type = self.class.attribute_type(attribute_name)

  ActiveRecord::ConnectionAdapters::Column.new(attribute_name.to_sym, type, type)
end
save(relative_path = nil, data = {}, options = {}) click to toggle source
Calls superclass method SmoothOperator::Persistence#save
# File lib/smooth_operator.rb, line 58
def save(relative_path = nil, data = {}, options = {})
  return false unless before_save

  clear_induced_errors

  save_result = valid? ? super : false

  after_save if valid? && save_result

  save_result
end