Topic: Association without nesting

I am having trouble passing an association WITHOUT nesting. I want to create categories for products by typing in the category as a string.


class Products< ActiveRecord::Base
  has_many :categories

class Categories< ActiveRecord::Base 
  belongs_to :product

I have a category text field within the product form.

Ryan Bates did an awesome screencast on this showing auto-complete associations … ssociation, but I can't figure out how he's creating that association behind the scenes.

Last edited by scottyw (2011-03-22 11:38:52)

Re: Association without nesting

I was able to solve this problem using a virtual attribute. Ryan Bates does a great job demonstrating virtual attributes in this Railscast: … attributes