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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:34:22+00:00 2026-05-20T12:34:22+00:00

My intent is to be able to edit a wine product and its associated

  • 0

My intent is to be able to edit a wine product and its associated awards/reviews in one form. So going to the page “http://mydomain.com/wines/cab-sauv/edit” shows the form in which I can edit the name, year, etc. It will also generate the list of awards and reviews so that I can add/remove/edit each award and review. Saving the wine will automatically save/update/delete the awards and reviews.

I’m having trouble generating the form for the nested objects (awards and reviews). The following is a modified example of what I’m currently attempting to do:

<% form_for @wine do |w| %>
    Stock: <%= w.text_field :stock, :size => 12 %>
    <% @wine.awards.each do |awd| %>
        Award: <%= w.select ???, @medals %>
    <% end %>
<% end %>

I’m not really getting nested resources when it comes to forms. Is there something I have to do in the routes as well?

  • 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-20T12:34:23+00:00Added an answer on May 20, 2026 at 12:34 pm

    Try this instead

    <% form_for @wine do |w| %>
       Stock: <%= w.text_field :stock, :size => 12 %>
       <% w.fields_for :awards do |awd| %>
         Award: <%= awd.select :awd_field_name, @medals %>
       <% end %>
     <% end %>
    

    In the file app/models/wine.rb, make sure you call this line somewhere,

    accepts_nested_attributes_for :awards
    

    You can read this excellent tutorial for nested resources too. http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes. Good luck!

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

Sidebar

Related Questions

I'm able to edit & save data from one Activity(EditActivity.java), but the updated data
I am able to intent to the youtube app to view a video easily
I have an App where I'd like to be able to edit any type
EDIT : I think I should clarify my intent... I'm trying to simplify the
EDIT: Changed example below to one that actually demonstrates the SIOF. I am trying
I need to be able to tell when a spawned activity (via an intent)
EDIT: I have figured out my main issue, but still have one concern. Everything
I intend to develop a J2ME application, that should be able to read words
Intent intent=new Intent(this,Game.class); intent.putExtra(razmer, level); startActivity(intent); method startActivity() call constuctor class.This method creat object
My intent is to proxy Roo Maven repository with my local Nexus installation, so

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.