Class: ActiveRemote::Base
- Inherits:
-
Object
- Object
- ActiveRemote::Base
- Extended by:
- ActiveModel::Callbacks
- Includes:
- ActiveModel::Model, ActiveModel::Validations::Callbacks, Association, Attributes, DSL, Dirty, Integration, Persistence, PrimaryKey, QueryAttributes, RPC, ScopeKeys, Search, Serialization, Validations
- Defined in:
- lib/active_remote/base.rb
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, #remote, #save, #save!, #skip_dirty_tracking
Methods included from Serialization
Methods included from Search
Methods included from ScopeKeys
Methods included from RPC
#assign_attributes_from_rpc, #remote_call, #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?, #remote, #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
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/active_remote/base.rb', line 47 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 Method Details
#freeze ⇒ Object
72 73 74 75 |
# File 'lib/active_remote/base.rb', line 72 def freeze @attributes.freeze self end |
#frozen? ⇒ Boolean
77 78 79 |
# File 'lib/active_remote/base.rb', line 77 def frozen? @attributes.frozen? end |
#init_with(attributes) ⇒ Object
Initialize an object with the attributes hash directly When used with allocate, bypasses initialize
63 64 65 66 67 68 69 70 |
# File 'lib/active_remote/base.rb', line 63 def init_with(attributes) @attributes = attributes @new_record = false run_callbacks :initialize self end |