Project

set_from

0.0
No commit activity in last 3 years
No release in over 3 years
A gem make a model column set from nother
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0

Runtime

 Project Readme

set_from

Example

class School < ActiveRecord::Base
  has_many :teachers
  has_many :courses
end

class Teacher < ActiveRecord::Base
  belongs_to :school
  has_many :courses
end

class Course < ActiveRecord::Base
  belongs_to :teacher
  belongs_to :school
  set_from :teacher, targets: [:school_id], update_for_change: true
end

school = School.create
teacher = Teacher.create(school: school)
course = teacher.courses.create
course.school_id # => school.id