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

The Archive Base Latest Questions

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

I have an invoice form. This is a simplified version: so it has line

  • 0

I have an invoice form. This is a simplified version: so it has line items where you select a drop down menu of product names.

This is working well: So the invoice-line_item relations is this: invoice has_many line_items and line_item belongs to invoice. line_item belongs to item and item has_many line_items. I have the items, line_items and invoice setup correctly.

But now I want to add taxes to the line items.

So I created a line_items_taxes table to create a HABTM relationship between line_items and taxes. But I can’t set it up correctly in the form. My form looks like this…

|name|price|tax|
|   v|     |  v|
|   v|     |  v|
|   v|     |  v|
[save invoice]

So I need a TAXES drop down select menu, and when the invoice is saved, it saves the tax for each line item.

I have tried the solutions offered at http://snippets.dzone.com/posts/show/4369 and Rails HABTM Question but I get errors.

undefined method merge for :name:Symbol
<%= f.collection_select "line_item", "tax_ids", @taxes, :id, :name, {:name => 'line_item[tax_ids][]'} %>

  • 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-27T23:30:09+00:00Added an answer on May 27, 2026 at 11:30 pm

    Your call to collection_select contains an extra parameter that is throwing things off. (Since I assume you are using *form_for*, the ‘line_item’ argument is automatically included, and yours is redundant.)

    It should instead look something like this:

    f.collection_select 'tax_ids', @taxes, :id, :name, {:name => 'line_item[tax_ids][]'}
    

    That’s a start in the right direction, anyway.

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

Sidebar

Related Questions

I have an invoice model, that has many invoice items. I have a form
I have an invoice. Line items are arranged in a table, basically like this:
I'm using ActiveAdmin and Formtastic. I have an invoice form that has a drop
If I have an Invoice Line Items table and a Products table, and I
I have a HTML form that mimics invoice input form. This is the way
I have a html file that has invoice details I would like to know
I have a query which produces a list of orders like this: Invoice Description
I have a nested form in a rails view that is called like this
I have an Invoice entity and it has child InvoiceLog entities. When I first
I'm building an app in CodeIgniter. I have an invoice form which uses jQuery

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.