I have a User model that's used to hold all Users. There's two types on users in my apps, mentors and students, but they have the same structure.
I want to do something like this.
has_many :requests, :foreign_key => mentor? ? 'mentor_id' : 'student_id', :class_name => 'Request'
I have the mentor? method in the model but it gives me a method_missing error. I'm assuming it's because it's looking for the method in dynamic_matchers.rb
This is the error it gives
/var/lib/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/dynamic_matchers.rb:55:in 'method_missing': undefined method 'mentor?' for #<Class:0x00000001b40630> (NoMethodError)
Is there a way to go about this without making a seperate models for the Student and Mentor? I feel that'd it be unnecessary seeing that they both use the same fields.