Forum: Ruby on Rails Select menu validation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E4c4a05719644c37f02dc5181de7c8c5?d=identicon&s=25 Buntin, Seth - KATE (Guest)
on 2006-02-22 16:38
(Received via mailing list)
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
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-02-22 22:08
(Received via mailing list)
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.
This topic is locked and can not be replied to.