0

Alright, so I've been working on this for a while and can't seem to figure it out. I've read extensively on guides.rubyonrails.org and thats how I got started. I successfully created the following HTML code.

 <tr>
    <th><%= f.label(:language_needs) %></th>
    <td><%= f.collection_check_boxes(:language_need_ids, LanguageNeed.all, :id, :theneed) %></td>
  </tr></br>
  <tr>
    <th><%= f.label(:type_projects) %></th>
    <td><%= f.collection_select(:type_project_ids, TypeProject.all, :id, :thetype) %></td>
  </tr></br>

With the following Migration

class AddNewSelectOptionsToProjects < ActiveRecord::Migration
  def change
    create_table :type_projects do |t|
      t.string :thetype
      t.timestamps
    end

    create_table :projects_type_projects, id: false do |t|
      t.belongs_to :type_project
      t.belongs_to :project
    end


    create_table :language_needs do |t|
      t.string :theneed
      t.timestamps
    end

    create_table :language_needs_projects, id: false do |t|
      t.belongs_to :language_need
      t.belongs_to :project
    end
  end
end

and the following db:seed

LanguageNeed.create(:theneed => "PHP")
LanguageNeed.create(:theneed => "HTML and CSS")
LanguageNeed.create(:theneed => "JavaScript")
LanguageNeed.create(:theneed => "Ruby on Rails")


TypeProject.create(:thetype => "Code Review One-Time") 
TypeProject.create(:thetype => "Ongoing Code Review") 
TypeProject.create(:thetype => "Pair Programming")
TypeProject.create(:thetype => "Website Application") 

everything is good, the question shows up, however I tried to use ransack gem, and realized that there is some issue with the habtm relationship. so right after the form I wanted to test if I could call on it so the page after I wrote

<%= @project.type_projects %>
<%= @project.language_needs %>

and I get this

#<ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_TypeProject:0xbb9b26c8> #<ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_LanguageNeed:0xbba1041c>

on the that page in the browser.

My question is how do I call whatever the person filling out the forms wrote for the collection_select, and collection_check_boxes question?

1 Answers1

0

I figured it out with the help of a dev. not on stackoverflow

the strong parameters were language_needs and type_projects and should have been language_need_ids and type_project_ids