Patrick McCafferty
2005-Aug-20 13:14 UTC
validates_inclusion_of doesn''t allow any input at all?
Here''s another interesting problem. (I''m starting to think some library somewhere on my system is a little brain-damaged at this point.) I''ve put validates_inclusion_of in my model: validates_inclusion_of :level, :in => 1..999 validates_inclusion_of :type, :in => %w( weapon armor ) and then attempted to create a new record. But when I go to create, it refuses to do so because the type is not in the list, whether I pick "weapon", "armor" or "tasty pudding". Of course, commenting the line out "corrects" the problem, but that''s hardly a good solution to this problem. What could be going on here? Like my previous problem it just seems like something low-level is horribly broken, but I can''t imagine what.
Nicholas Seckar
2005-Aug-20 16:16 UTC
Re: validates_inclusion_of doesn''t allow any input at all?
Patrick McCafferty wrote:> validates_inclusion_of :type, :in => %w( weapon armor )I think your problems are probably due to type being AR''s STI column. You might try using column name ''kind'' instead.
Patrick McCafferty
2005-Aug-20 20:41 UTC
Re: validates_inclusion_of doesn''t allow any input at all?
Thanks, you''re right. I noticed it had a lot of errors when I ran the test beyond just "Failed" so I changed the column name and it works. Other strangeness (to me!) to follow... Thanks for the help. On 8/21/05, Nicholas Seckar <nseckar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Patrick McCafferty wrote: > > validates_inclusion_of :type, :in => %w( weapon armor ) > > I think your problems are probably due to type being AR''s STI column. > You might try using column name ''kind'' instead. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >