Rails - How to secure foreign keys and still allow association selection
- by Bryce
For simplicity, assume that I have a simple has-many-through relationship
class User < ActiveRecord::Base
has_many :courses, :through => :registrations
end
class Registration < ActiveRecord::Base
belongs_to :user
belongs_to :course
end
class Course < ActiveRecord::Base
has_many :users, :through => :registrations
end
I…