Class: MR::FakeRecord::Association
- Inherits:
-
Object
- Object
- MR::FakeRecord::Association
- Defined in:
- lib/mr/fake_record/associations.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
ActiveRecord method.
-
#reflection ⇒ Object
readonly
ActiveRecord method.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(owner, reflection) ⇒ Association
constructor
A new instance of Association.
-
#klass ⇒ Object
ActiveRecord method.
- #read ⇒ Object
- #write(value) ⇒ Object
Constructor Details
#initialize(owner, reflection) ⇒ Association
Returns a new instance of Association.
183 184 185 186 187 |
# File 'lib/mr/fake_record/associations.rb', line 183 def initialize(owner, reflection) @owner = owner @reflection = reflection @ivar_name = "@#{@reflection.name}" end |
Instance Attribute Details
#owner ⇒ Object (readonly)
ActiveRecord method
181 182 183 |
# File 'lib/mr/fake_record/associations.rb', line 181 def owner @owner end |
#reflection ⇒ Object (readonly)
ActiveRecord method
181 182 183 |
# File 'lib/mr/fake_record/associations.rb', line 181 def reflection @reflection end |
Instance Method Details
#<=>(other) ⇒ Object
197 198 199 |
# File 'lib/mr/fake_record/associations.rb', line 197 def <=>(other) other.kind_of?(Association) ? self.reflection <=> other.reflection : super end |
#klass ⇒ Object
ActiveRecord method
193 194 195 |
# File 'lib/mr/fake_record/associations.rb', line 193 def klass self.reflection.klass end |
#read ⇒ Object
189 |
# File 'lib/mr/fake_record/associations.rb', line 189 def read; raise NotImplementedError; end |
#write(value) ⇒ Object
190 |
# File 'lib/mr/fake_record/associations.rb', line 190 def write(value); raise NotImplementedError; end |