Class: ActiveRemote::Base
- Inherits:
-
Object
- Object
- ActiveRemote::Base
- Extended by:
- ActiveModel::Callbacks
- Includes:
- ActiveAttr::AttributeDefaults, ActiveAttr::Attributes, ActiveAttr::BasicModel, ActiveAttr::BlockInitialization, ActiveAttr::ChainableInitialization, ActiveAttr::Logger, ActiveAttr::MassAssignment, ActiveAttr::QueryAttributes, ActiveAttr::Serialization, ActiveModel::Validations::Callbacks, Association, AttributeDefaults, Attributes, Bulk, DSL, Dirty, Integration, Persistence, PrimaryKey, Publication, RPC, ScopeKeys, Search, Serialization, Typecasting, Validations
- Defined in:
- lib/active_remote/base.rb
Constant Summary
Constants included from Typecasting
Instance Attribute Summary collapse
-
#last_request ⇒ Object
readonly
Returns the value of attribute last_request.
-
#last_response ⇒ Object
readonly
Returns the value of attribute last_response.
Instance Method Summary collapse
- #freeze ⇒ Object
- #frozen? ⇒ Boolean
-
#initialize ⇒ Base
constructor
A new instance of Base.
Methods included from Validations
Methods included from Dirty
#disable_dirty_tracking, #enable_dirty_tracking, #reload, #save, #save!, #skip_dirty_tracking, #write_attribute
Methods included from Serialization
#add_errors, #add_errors_from_response, #serialize_records
Methods included from Search
#_active_remote_search, #reload
Methods included from ScopeKeys
Methods included from RPC
Methods included from Publication
#_publishable_json_attributes, #_publishable_json_methods, #publishable_hash
Methods included from PrimaryKey
Methods included from Persistence
#delete, #delete!, #destroy, #destroy!, #has_errors?, #instantiate, #new_record?, #persisted?, #readonly!, #readonly?, #save, #save!, #success?, #update_attribute, #update_attributes, #update_attributes!
Methods included from Integration
Methods included from Attributes
#attributes, #read_attribute, #write_attribute
Methods included from AttributeDefaults
#apply_defaults, #attribute_defaults
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/active_remote/base.rb', line 63 def initialize(*) @attributes ||= begin attribute_names = self.class.attribute_names Hash[attribute_names.map { |key| [key, send(key)] }] end @new_record = true skip_dirty_tracking do run_callbacks :initialize do super end end end |
Instance Attribute Details
#last_request ⇒ Object (readonly)
Returns the value of attribute last_request.
59 60 61 |
# File 'lib/active_remote/base.rb', line 59 def last_request @last_request end |
#last_response ⇒ Object (readonly)
Returns the value of attribute last_response.
59 60 61 |
# File 'lib/active_remote/base.rb', line 59 def last_response @last_response end |
Instance Method Details
#freeze ⇒ Object
78 79 80 |
# File 'lib/active_remote/base.rb', line 78 def freeze @attributes.freeze; self end |
#frozen? ⇒ Boolean
82 83 84 |
# File 'lib/active_remote/base.rb', line 82 def frozen? @attributes.frozen? end |