Ruby on Rails Development: updating model attribute using f.association collection -
IM is currently working on a rail program. It has many different databases but I have people, students and faculty tables to keep things simple.
A person may be a student or faculty member and there is a person connected by all persons / ID. A faculty member advises the students so that the student is connected to faculty member by faculty ID.
To make a student, you have to choose a major and a faculty member (FacultyID). Being a student and faculty members are all people .. in my dropdown me
& Lt; / Div & gt; To limit people to the faculty members only in the drop down
But now the issue which is going on in the I How do I set up the Faculty_ID feature?
I was able to detect the solution as it turns f.association to limit the dropdown list I have created a form form to prepare a list of consultants using SQL in my person controller
def set_advisors @role = Role Find_by_role_name ('advisor') @ Edwise = Person.find_by_sql ("Selection AID, P.Fine.Fe as People, P In the form of people, a. Pissar_ID = PID and P. FoleyID = "+ @ role.id. To_s") end
By doing so I
was able to use the feature to update the feature so much. Div class = "field" id = "advisory id" & gt; & Lt;% = f.label: faculty_id, 'advisor'% & gt; & Lt;% = f.collection_select (: faculty_id, @advisors ,: id ,: fname)%> & Lt; / Div & gt; Hope there is a need to limit anybody in it, like drop down like me):
Comments
Post a Comment