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.

Models:

class Products< ActiveRecord::Base
  has_many :categories
end

class Categories< ActiveRecord::Base 
  belongs_to :product
end

I have a category text field within the product form.

Ryan Bates did an awesome screencast on this showing auto-complete associations http://railscasts.com/episodes/102-auto … 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: http://railscasts.com/episodes/167-more … attributes