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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:11:55+00:00 2026-05-15T14:11:55+00:00

I have some orders with nested items and the items have nested kinds. When

  • 0

I have some orders with nested items and the items have nested kinds. When i do a form_for @order in a view, then i would like to hide all the items that have their :registered attribute set to true

<% form_for @order do |f| %>
  <% f.fields_for :items do |ff| %>
    <%# show all the items that have :registered == false %>
  <% end %>
<% end %>

or

def register
  @order = Order.find(params[:id])
  # Sort out the :registered == true
end
  • 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-15T14:11:56+00:00Added an answer on May 15, 2026 at 2:11 pm

    You can try something like this:

    <% form_for @order do |f| %>
      <% f.fields_for :items do |ff| %>
        <% next if ff.object.registered %>
        <%# show all the items that have :registered == false %>
      <% end %>
    <% end %>
    

    Or you can create a second association for unregistered items:

    class Order < ActiveRecord::Base
      has_many :unregistered_itmes, :class_name => "Item", :conditions => { :registered => false } 
    end
    

    And then you can do something like this:

    <% form_for @order do |f| %>
      <% f.fields_for :unregistered_items do |ff| %>
        <%# show all the items that have :registered == false %>
      <% end %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get some nested params. I have an Order that has
i have some Orders that can have several Items and these Items have an
I have some code that runs fairly well, but I would like to make
I have some things in my app that I need to store, in order
I have some sprocs that need a temp table. In order not to hardcode
I am taking some code that I have used for a nested listview before
I have a bunch of nested checkboxes. I would like to make a selection
Now that I've read all the DQL docs I still have some doubts, I'm
I have a app to manage book orders from some people, here is the
I have some problem to order an array by a field of this, here

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.