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

  • Home
  • SEARCH
  • 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 1105765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:41:08+00:00 2026-05-17T01:41:08+00:00

Job has many task, task has many notes How should such a form look

  • 0

Job has many task, task has many notes

How should such a form look like ? With partials so I can enter the whole job from /jobs/new , and add new tasks from /jobs/2/tasks/new with possibility to add notes from there, and of course the possibility to add new notes from /jobs/2/tasks/5/notes/new ?

Is this a good place to use the presenter pattern ? When yes, which library should I use ?
I have tried the rails3 branch of active_presenter on github but I had some troubles with the form partials.

Have somebody a good example for such a task ?

There are plenty of presenter tutorials, nested forms tutorials, and unobtrusive javascript tutorials, but not only one have explained all together.

It would be nice if someone pasted a tutorial using html5 and rails3 examples

  • 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-17T01:41:08+00:00Added an answer on May 17, 2026 at 1:41 am

    Presenter pattern isn’t necessarily the best fit here, actually.

    You’ll probably get futher by just using accepts_nested_attributes_for:

    # Models
    class Job < ActiveRecord::Base
      has_many :tasks, :autosave => true
      accepts_nested_attributes_for :tasks
    end
    
    class Task < ActiveRecord::Base
      belongs_to :job
      has_many :notes, :autosave => true
      accepts_nested_attributes_for :notes
    end
    
    class Note < ActiveRecord::Base
      belongs_to :task
    end
    

    And then in your form doing something like (in HAML):

    = form_for @job do |job|
      = job.text_field :name # or whatever your Job attributes are
      = job.fields_for :tasks do |task|
        = task.text_field :name
        = task.check_box_field :complete
        = task.fields_for :notes do |note|
          = note.text_field :body
      = job.submit "Create Job"
    

    You may have to actually initialise some tasks/notes for new jobs or the associated record forms might not show up. E.g., do something like 3.times { @job.tasks.build } to create 3 blank tasks (and therefore display the task sub-form 3 times).

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

Sidebar

Related Questions

I have a job model which has many attributes. I would like to use
i have two models: class Category has many :jobs end class Job belongs_to :category
I am running a batch job that has been going for many many hours,
I have two entities: Patient and Job. Patient has a to-many relationship to Job
I know I can see how much memory a pbs job has requested using
This task has already been asked/answered, but I recently had a job interview that
this is what I mean: job has many docs. I want to create a
I have two models Jobs and Questions. A job has many questions and questions
in my job (intranet)- I have an aspx page which has many Iframes (
I have three resources: Jobs, Questions and Answers. The relationships are: Job has many

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.