I'm using the acts-as-taggable-on gem in my rails application and everything work fine, but i want o limit the number of tags allowed to 5 for example (Like Stackoverflow) so I have searched in the acts-as-taggable-on documentation but didn't find anything, so I'm wondering if this is possible and how can I achieve this?
Actually my code look like this
<%= f.text_area :skill_list %>
Tags could act as Array. So in your case try to limit by return false if array.count > 5
def limit
raise 'Tooooo long' if array.length > 5
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.