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 7701821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:05:08+00:00 2026-05-31T23:05:08+00:00

I would be very grateful if someone could help me with this. I have

  • 0

I would be very grateful if someone could help me with this.

I have a Tasks model, and Projects model. As you can imagine, Projects have many tasks and tasks belong to many projects.

I also have a table of relatoinships, where a task is related to a project.

What I don’t know how to do, is: I have a page where all the tasks are shown, and another page where all the projects are shown. I want the user to be able to select a task and assign it to a project. I don’t know how to pass the id of the selected task to the next page, where the projects are listed, and then with the id of the selected project create a relationship between those two id’s.

could someone help me on how to approach this? I’m not sure if I should use a cookie to save the value of the task, or if there is another way to do this..

thank you very much!
Joaquin (please excuse my english)

  • 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-05-31T23:05:10+00:00Added an answer on May 31, 2026 at 11:05 pm

    From what you’re describing you’ll probably want to do the association through the task’s form and then check all of the projects to which the task belongs. Your task form would look something like:

    app/views/tasks/edit.html.erb:

    <%= form_for @task do |f| %>
     <div>
        <%= f.label :name %>
        <%= f.text_field :name %>
     </div>
     <% Project.all.each do |project| %>
        <div>
          <%= check_box_tag :project_ids, project.id, @task.projects.include?(project), :name => 'task[project_ids][]' -%>
          <%= label_tag :project_ids, project.name -%>
        </div>
     <% end %>
     <%= f.submit %>
    <% end %>
    

    Then, in your tasks_controller’s update method, you’d need something like:

    def update
        @task = Task.find params[:id]
        projects = Project.find(params[:task][:project_ids]) rescue []
        @task.projects = projects
        if @task.update_attributes(params[:task])
          …
    end
    

    And the link on your tasks list would be to the task’s edit page which contains the above ex:

    <% for task in Task.all %>
     <%= link_to "edit task", edit_task_path(task) %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would be so very grateful if someone could help me out! I have
I would be very grateful if someone could help me break through this issue
This is driving me crazy. Very grateful if someone could help me out! Problem:
I would be grateful if someone could help me out here. I'm just starting
I would be very grateful if someone could explain if it is possible to
have small problem, and would very much appreciate help :) I should convert byte
Would very much appreciate any help or hint on were to go next. I'm
I thought this would be very easy. I downloaded the JDK, extracted src.zip, modified
I have a project in mind whose main selling point would be very good
This may seem to be an academic question, but still I would be very

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.