Hide a Collection_Select Option
I have dropdown built by option_groups_from_collection_for_select(Category.all, :subcategories, :name, :id, :name)
. How ca开发者_如何转开发n I hide one of the categories that appears?
Instead of Category.all
, you can pass in
Category.where("id NOT IN (?)", [1, 2, 3])
That will exclude categories with ids 1, 2 and 3.
精彩评论