RailsCasts Pro episodes are now free!

Learn more or hide this

hickscorp's Profile

GitHub User: hickscorp

Comments by

Avatar

Hello Ryan :)

First of all, thanks a lot for all those great episodes... i've been watching them all for a long time now, and this is my first question.

Let's say i have a setup like that:

Item model, has a name field as required by the tokenizer jQuery plugin:
has_many :item_components
has_many :components,
:through => :item_components,
:source => :component,
:class_name => 'Item'

Item component model, also has a quantity field:
belongs_to :item,
:foreign_key => :item_id,
:class_name => 'Item'
belongs_to :component,
:foreign_key => :component_id,
:class_name => 'Item'

You can picture that models setup as a recipe self-referential tree. The tokenizer solution works great until i want to add the "quantity" into the view... The thing is that i'd like to be able to include it (and make it editable at the same time, but that's another issue). But this quantity field is on the ItemComponent model, not on the Item model... So how can my tokenizer can be aware of it?

Thanks a lot for your time, and keep up the good work!
Kind regards,
Pierre.