Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:12:44+00:00 2026-06-12T12:12:44+00:00

I having real problems trying to get my edit and update actions working for

  • 0

I having real problems trying to get my edit and update actions working for my app. I am wanting to edit the technologies that are linked with a project.

def edit
  @project = Project.find(params[:id])

  @project_technol = @project.projecttechnols.build
end



def update
   @project = Project.find(params[:id])
   @project.client = params[:new_client] unless params[:new_client].blank?
   @project.role = params[:new_role] unless params[:new_role].blank?
   @project.industry = params[:new_industry] unless params[:new_industry].blank?
   @project.business_div = params[:new_business_div] unless params[:new_business_div].blank?

   params[:technols][:id].each do |tech|

     if !tech.empty?

      @project_technol = @project.projecttechnols.build(:technol_id => tech) 

   end

Project model:

class Project < ActiveRecord::Base
  attr_accessible  :fullname, :edited_first_name, :edited_last_name, :first_name, :last_name, :business_div, :client, :customer_benefits, :edited_date, :end_date, :entry_date,:industry, :keywords, :lessons_learned, :project_name, :project_owner, :role, :start_date, :status, :summary, :tech , :technols, 

has_many :projecttechnols
has_many :technols, :through => :projecttechnols

accepts_nested_attributes_for(:technols)

When I enter the edit form, the previous technologies that were selected are not selected in the collection select.

EDIT form:

<%= f.fields_for(@project_technol) do |t| %>
  <%= t.label "Choose Technologies"%> </br>
  <%= t.collection_select(:id, Technol.all, :id, :tech, {}, {:multiple => true } ) %>
<% end %>

<% @project.technols.each do |t| %>
    <li><%= t.tech %> <%= link_to "Details", technol_path(t), method: :delete, %></li>
  <% end %>

I can see which technologies are there using the @project.technols.each do |t| loop, so they are being found, but they are not showing up the collection_select. Please can someone point me in the right direction. I am new to rails so it could be something every simple that I’m not understand. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:12:45+00:00Added an answer on June 12, 2026 at 12:12 pm

    Try something like this:

    <p><%= f.label :skills %><ul>
    <% for skill in Skill.all %>
        <li>
          <%= check_box_tag "user[skill_ids][]", skill.id, @user.skills.include?(skill) %>
          <%= skill.name %>
        </li>
    <% end %>
    </ul>
    </p>
    

    Remove the code from your update action

       params[:technols][:id].each do |tech|
    
         if !tech.empty?
    
          @project_technol = @project.projecttechnols.build(:technol_id => tech) 
    
       end
    

    In your project model, you’ll need something like

    enter code hereattr_accessible :technols_ids

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having real problems trying to get a ruby script to run through
I'm having real problems getting PDO_MYSQL working. I started by just trying to install
I am having real problems trying debug my code to malfunctioning print statements. I
I am having real problems trying to extract the text between a HTML header
Having real problems creating artifacts in teamcity 6.5 (using TFS & MSBuild as the
First time cake user and I'm having real apache problems. For some reason the
I have a Google spreadsheet and I am having real difficulty trying to work
I'm having a real problem with this because I just can't get my head
I'm pretty new to C# and am having a mare trying to get what
Hi everyone I am having a problem trying to get this to work. Basically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.