Forum: Ruby on Rails Displaying relationship attributes in MTM relationships

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Vishwaraj (Guest)
on 2007-03-06 11:48
I have following many to many relationship:
class Service < ActiveRecord::Base
has_many :service_dependencies
has_many :dependents, :through => :service_dependencies

class ServiceDependency < ActiveRecord::Base
belongs_to :service
belongs_to :dependent, :class_name => 'Service', :foreign_key =>

However, in my schema the MTM table service_dependencies has few
relationship attributes as well, e.g. impact, severity, etc. along
with the foreign keys.

Right now, I'm displaying the dependent services' fields in following

<% for dependents in @service.dependents %>
     <b>Service Name:</b><br> <%=h dependents.send("service_name")
<% end %>

I want to display the relationship attributes, impact, severity as well,
could someone please help me by letting me know how to access them in my
view page?
This topic is locked and can not be replied to.