Friday, 27 September 2013

Tagging only with existing tags and view with select

Tagging only with existing tags and view with select

I have a model CuisineTag that stores tags names in :title And Restaurant
that has many cuisine_tags
class CuisineTag < ActiveRecord::Base
attr_accessible :title
has_and_belongs_to_many :restaurants
end
class Restaurant < ActiveRecord::Base
has_and_belongs_to_many :cuisine_tags
# ...
end
How to make possible to add cuisine_tags to restaurant only via selecting
it through select box? Also i need add/remove cuisine_tags when editing
restaurant.
Please, provide some sample code.

No comments:

Post a Comment