title: Rails collection_select many to many
body: <p>I have a form with two collection_select fields, the first one is an easy one, it just gets a model named courses, which shows the course name, and of course returns the id of the selected course, the second is the one Im having problems with, its a collection_select of the similar courses a course may have.</p>
  
  <p>The courses model:</p>
  
  <pre><code>class Course &lt; ActiveRecord::Base
    extend FriendlyId
    friendly_id :name, use: :slugged 
    attr_accessible :code, :credits, :name, :description, :active
  
    has_many :similars, dependent: :destroy
    has_many :similar_courses, through: :similars, source: :similar
  
  end
  </code></pre>
  
  <p>The similar model: </p>
  
  <pre><code>class Similar &lt; ActiveRecord::Base
    attr_accessible :course_id, :similar_id
  
    belongs_to :course
    belongs_to :similar, class_name: "Course"
  
    validates :similar_id, presence: true
    validates :course_id, presence: true
  
  end
  </code></pre>
  
  <p>this is the homologate model, the thing with this model is that a course must be approved or rejected if one wants to transfer classes and stuff like that:</p>
  
  <pre><code>class Homologation &lt; ActiveRecord::Base
    attr_accessible :homologate_by, :homologate_course, :student_id
    belongs_to :user
  end
  </code></pre>
  
  <p>this is the form Im having problems with:</p>
  
  <pre><code>&lt;%= form_for(@homologation) do |f| %&gt;
        &lt;%= render 'shared/error_messages', object: @homologation %&gt;
        &lt;%= f.label :homologate_course %&gt;
        &lt;%= f.collection_select :homologate_course, Course.find(:all), :id, :name, :prompt =&gt; "Select a Course" %&gt;
  
        &lt;%= f.label :homologate_by %&gt;
        &lt;%= f.collection_select :homologate_by, Similar.find(:all), :similar_id, :name, :prompt =&gt; "Select a Similar Course" %&gt;
      &lt;div class="form-actions"&gt;
        &lt;%= f.submit "Create Homologation", class: "btn btn-large btn-primary" %&gt;
      &lt;/div&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Im getting the following error</p>
  
  <p><a href="http://dpaste.com/hold/827744/" rel="nofollow">http://dpaste.com/hold/827744/</a></p>
  
  <p>the Bartolleti thing is the name of the course I want to be able to show, and that of course is not a method, but I dont know Why Im getting the error, I want to be able to show the names of the similar courses given the first collection field course...</p>
  
  <p>Thank you for your help!</p>