Is there a trick to validating select menus? I have this rule: validates_presence_of :title, :type :title is a text box and validates correctly but :type doesn''t: <p> <label for="resource_type">Type</label><br/> <select name="resource[type]" id="resource_type"> <option value="" selected="selected"></option> <option value="Web">Web</option> <option value="Data">Data</option> </select> </p> Seth Buntin Web Resources Coordinator Kentucky Academy of Technology Education Murray State University -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060222/0bfacba7/attachment.html
Buntin, Seth - KATE wrote:> Is there a trick to validating select menus? I have this rule: > > validates_presence_of :title, :type > > :title is a text box and validates correctly but :type doesn?t:You may be running into trouble because "type" is a built-in method for all Ruby objects. Try another attribute name. If that doesn''t fix it, post your validation code. -- We develop, watch us RoR, in numbers too big to ignore.
Thanks man. I found that out earlier. What a hassle. I didn''t even think about it because it wasn''t in the reserved words list. Seth -----Original Message----- From: Mark Reginald James [mailto:mrj@bigpond.net.au] Sent: Wednesday, February 22, 2006 3:05 PM To: rails@lists.rubyonrails.org Subject: [Rails] Re: Select menu validation Buntin, Seth - KATE wrote:> Is there a trick to validating select menus? I have this rule: > > validates_presence_of :title, :type > > :title is a text box and validates correctly but :type doesn''t:You may be running into trouble because "type" is a built-in method for all Ruby objects. Try another attribute name. If that doesn''t fix it, post your validation code. -- We develop, watch us RoR, in numbers too big to ignore.