Created
March 6, 2013 17:56
-
-
Save iwada/5101480 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#course_helper | |
def coursenames(courseid) | |
@coursedept = Department.all(:include => :courses, :conditions => ["courses.id = ?",courseid]) | |
for i in @coursedept | |
return i.name #return the department's name | |
end | |
end | |
<% @course.each do |course| %> | |
<tr> | |
<td><%= course.code %></td> | |
<td><%= course.name %></td> | |
<td><%= coursenames(course.id) %> | |
</td> ... | |
#Assuming a course belongs to more than one Department,this only shows the first Department the course belongs to. | |
#How do i please get the rest as a comma seperated list | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment