RAILS 3 model validation inclusion in does not work -


# ==schema information # schema version: # table name: terms #  id                 :integer         not null, primary key ... #  user_id            :integer #  term_type          :string(255)` 

term.rb:

  class term < activerecord::base  validates   :term_type,         :inclusion => { :in => %w(term segment entity abbreviation) }` 

rails 3.0.3, ruby 1.8.7, windows via cygwin validation not seem work, i.e. accepts value term_type. when using inclusion (or validates_inclusion_of produces same fail condition) need db validations matching in model? issues strings should wary of?

term_type string in db , not separate table.

any pointers appreciated.

vince

have tried using

validates :field, :inclusion => %{abc ade aeee} 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -