Class: ActiveRemote::Base
- Inherits:
-
Object
- Object
- ActiveRemote::Base
- Extended by:
- ActiveModel::Callbacks, ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations, ActiveModel::Validations::Callbacks, Association, AttributeAssignment, Attributes, DSL, Dirty, Integration, Persistence, PrimaryKey, QueryAttributes, 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
-
#init_with(attributes) ⇒ Object
Initialize an object with the attributes hash directly When used with allocate, bypasses initialize.
-
#initialize(attributes = {}) ⇒ 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
Methods included from Serialization
Methods included from Search
Methods included from ScopeKeys
Methods included from RPC
Methods included from QueryAttributes
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
#==, #attribute, #attribute=, #attribute_method?, #attributes, #inspect, #read_attribute, #write_attribute
Methods included from AttributeAssignment
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/active_remote/base.rb', line 55 def initialize(attributes = {}) @attributes = self.class.send(:default_attributes_hash).dup assign_attributes(attributes) if attributes @new_record = true skip_dirty_tracking do run_callbacks :initialize do yield self if block_given? end end end |
Instance Attribute Details
#last_request ⇒ Object (readonly)
Returns the value of attribute last_request.
51 52 53 |
# File 'lib/active_remote/base.rb', line 51 def last_request @last_request end |
#last_response ⇒ Object (readonly)
Returns the value of attribute last_response.
51 52 53 |
# File 'lib/active_remote/base.rb', line 51 def last_response @last_response end |
Instance Method Details
#freeze ⇒ Object
80 81 82 |
# File 'lib/active_remote/base.rb', line 80 def freeze @attributes.freeze; self end |
#frozen? ⇒ Boolean
84 85 86 |
# File 'lib/active_remote/base.rb', line 84 def frozen? @attributes.frozen? end |
#init_with(attributes) ⇒ Object
Initialize an object with the attributes hash directly When used with allocate, bypasses initialize
71 72 73 74 75 76 77 78 |
# File 'lib/active_remote/base.rb', line 71 def init_with(attributes) @attributes = attributes @new_record = false run_callbacks :initialize self end |