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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:40:23+00:00 2026-05-20T06:40:23+00:00

Need help figuring this out. Have a product model: class Product :name :short_description :price

  • 0

Need help figuring this out.

Have a product model:

class Product 
   :name 
    :short_description 
    :price 
    :cost 
    :visible 
    :new_service 
    :deleted 
    :category_id 
 end

Have a line item model. Pretty much copies product model except:

class LineItem
    :order_id 
    :customer_id
    :company_id
end

Now need to figure out how to add a Product Group which will consists of multiple products and carry all of the same attr as the product model. Normally I would do a joins table with :ids, but need the ability to edit the price and cost of each product in the group.

Stumped on this one.

  • 1 1 Answer
  • 1 View
  • 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-20T06:40:24+00:00Added an answer on May 20, 2026 at 6:40 am
    class ProductGroup
      has_many :special_products
    end
    
    class SpecialProducts
      belongs_to :product
      belongs_to :product_group
    
      #attributes for overridden prices
      #delegate other attributes to product
      delegate :name, :to => :product, :allow_nil => true
    end
    
    class Product
      has_many :special_products
      has_many :product_groups, :through => :special_products
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help figuring this out. I have two tables user ---- name skills (comma
I know I'm close to figuring this out but need a little help. What
I need some help figuring out how I should do this. I would like
need some help figuring this out. My function: function cleanDatabase() { $allowedTime = $this->time
I need some help figuring out how to write this .htaccess . My file
I need help figuring out an error in my SQL statement. I have been
I need help figuring out which Accessory Type Switch has been changed. I have
http://jsfiddle.net/nicktheandroid/ZSvHK/ I need help figuring out how to get this right, problems listed below.
I am having an absolute headache figuring this out. I badly need some help
I need help figuring this question out. I've tried searching and I think I

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.