A better solution has been provided by @SooDesuNe on this SO post
validates :tags, length: { minimum: 1, maximum: 6 }
More Related Contents:
- accepts_nested_attributes_for with find_or_create?
- Rails 3: “field-with-errors” wrapper changes the page appearance. How to avoid this?
- Rails has_many :through Find by Extra Attributes in Join Model
- How do I validate a date in rails?
- Rails: What’s a good way to validate links (URLs)?
- rails built in datetime validation
- Validate uniqueness of multiple columns
- Rails – Validate Presence Of Association?
- Why use “self” to access ActiveRecord/Rails model properties?
- Rails validation over redirect
- Ruby on Rails – Validate a Cost
- Validation failed: Upload file has an extension that does not match its contents
- Ruby on Rails Callback, what is difference between :before_save and :before_create?
- Controlling the order of rails validations
- Validates acceptance always failing
- Rails Model has_many with multiple foreign_keys
- Fully custom validation error message with Rails
- devise and multiple “user” models
- Overriding id on create in ActiveRecord
- How to execute a raw update sql with dynamic binding in rails
- Why do people use Heroku when AWS is present? What distinguishes Heroku from AWS? [closed]
- How to `bundle install` when your Gemfile requires an older version of bundler?
- undefined method `get’ for #
- Find unused code in a Rails app
- SimpleForm without for (non model form)
- Rails: How to parse date-time string into a specific time zone
- What does binding a Rails Server to 0.0.0.0 buy you?
- What is the difference between pluck and collect in Rails?
- How to integrate a Wrap Bootstrap theme into an Rails application?
- Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?