liveh2o / active_remote

Active Remote provides Active Record-like object-relational mapping over RPC. It's Active Record for your platform.
MIT License
63 stars 23 forks source link

Association attribute writer does not work when association name doesn't match association class #92

Closed liveh2o closed 2 years ago

liveh2o commented 2 years ago

When defining an association with a name that doesn't match the class, the writer method does not work:

class Job < ActiveRemote::Base
end

class Member < ActiveRemote::Base
  belongs_to :recent_job, :class_name => "Job"
end
2.6.10 :002 > m = Member.new
2.6.10 :002 > m.recent_job = Job.new
 =>  #<Job ... >
2.6.10 :003 > m.recent_job
 => nil
liveh2o commented 2 years ago

Resolved by https://github.com/liveh2o/active_remote/commit/85b369aee7e41943be374f1e6bf11dbeb5c4888c.