Class: SmoothOperator::Rails

Inherits:
Base show all
Includes:
ActiveModel::Conversion, ActiveModel::Validations, ActiveModel::Validations::Callbacks
Defined in:
lib/smooth_operator.rb

Constant Summary

Constants included from HttpMethods

HttpMethods::HTTP_VERBS

Instance Attribute Summary

Attributes included from Associations

#rails_serialization

Attributes included from Persistence

#last_remote_call

Attributes included from ResourceName

#resource_name, #resources_name

Attributes included from AttributeAssignment

#_meta_data, #_options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

smooth_operator?

Methods included from Schema

#attribute_type, #internal_structure, #known_attribute?, #schema

Methods included from Associations

#belongs_to, #has_many, #has_one, #reflect_on_all_associations, #reflect_on_association, #reflections

Methods included from FinderMethods

#find

Methods included from Translation

#human_attribute_name

Methods included from Persistence

#destroy, #destroyed?, included, #known_attribute?, #marked_for_destruction?, #new_record?, #persisted?, #reload, #save!

Methods included from Operator

included, #make_the_call, #resource_path

Methods included from ResourceName

#custom_model_name, #model_name, #model_name=

Methods included from AttributeAssignment

#assign_attributes, included, #initialize

Methods included from Serialization

#attributes, #read_attribute_for_serialization, #serializable_hash, #to_hash, #to_json

Methods included from InternalData

#internal_data, #internal_data_get, #internal_data_push, #known_attribute?, #known_attributes

Methods included from Validations

#clear_induced_errors, included, #induce_errors, #induced_errors, #invalid?, #valid?

Methods included from Delegation

included, #method_missing, #respond_to?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SmoothOperator::Delegation

Class Method Details

.model_nameObject



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

def self.model_name
  smooth_model_name
end

Instance Method Details

#after_saveObject



67
# File 'lib/smooth_operator.rb', line 67

def after_save; end

#before_saveObject



63
64
65
# File 'lib/smooth_operator.rb', line 63

def before_save
  true
end

#column_for_attribute(attribute_name) ⇒ Object



45
46
47
48
49
# File 'lib/smooth_operator.rb', line 45

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 = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/smooth_operator.rb', line 51

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