How to manage auto complete HABTM in Rails?

I am looking for a good solution to a typical model management problem with the HABTM association in Rails.

Suppose we have two models - products and categories:

Products
  has_many :categorizations
  has_many :categories, :through => :categorizations
Categories
  has_many :categorizations
  has_many :products, :through => :categorizations
Categorization
  belongs_to :product
  belongs_to :category

Pat Shaughnessy is developing a modified auto_complete plugin that allows you to manage a one-to-many association (and many-to-many):

alt text http://img28.imageshack.us/img28/9141/samplef.th.png alt text http://img406.imageshack.us/img406/4075/sampleautocomplete.th.png

- , . , , , :

alt text http://img405.imageshack.us/img405/9576/betterautocomplete.th.png

(--) | (--), .

, .

, . Ruby , ​​.

!

+3
3

. jQuery.

, - Ruby on Rails.:) , !

0

Source: https://habr.com/ru/post/1719123/


All Articles