开发者

Hide a Collection_Select Option

开发者 https://www.devze.com 2023-03-16 18:35 出处:网络
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 Categor

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消