This code:
<p>
<label for="resource_type">Type</label><br/>
<%= select(:resource, :type, %w{ Web Data }, { :include_blank => true
}) %>
</p>
Produces this error:
TypeError in Resources#new
Showing app/views/resources/_form.rhtml where line #6 raised:
wrong argument type String (expected Module)
Extracted source (around line #6):
3: <legend>Resource General</legend>
4:
5: <p><label
for="resource_type">Type</label><br/>
6: <%= select(:resource, :type, %w{ Web Data }, { :include_blank
=> true }) %>
7: </p>
8:
9: <p><label
for="resource_focus_id">Focus</label><br/>
I took it straight out of the Agile Web Development book (except the
:include_blank)
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/20060221/0a23e0bb/attachment-0001.html
Buntin, Seth - KATE wrote:> This code: > > <p> > > <label for="resource_type">Type</label><br/> > > <%= select(:resource, :type, %w{ Web Data }, { :include_blank => true > }) %> > > </p> >You have missed out the options parameter. select(object, method, choices, options = {}, html_options = {}) select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) -- Posted via http://www.ruby-forum.com/.
%w{ Web Data } is my options.
-----Original Message-----
From: Anthony Green [mailto:email@acgreen.co.uk]
Sent: Wednesday, February 22, 2006 9:57 AM
To: rails@lists.rubyonrails.org
Subject: [Rails] Re: Select error
Buntin, Seth - KATE wrote:> This code:
>
> <p>
>
> <label for="resource_type">Type</label><br/>
>
> <%= select(:resource, :type, %w{ Web Data }, { :include_blank =>
true> }) %>
>
> </p>
>
You have missed out the options parameter.
select(object, method, choices, options = {}, html_options = {})
select("post", "person_id", Person.find_all.collect {|p| [
p.name, p.id
] }, { :include_blank => true })
--
Posted via http://www.ruby-forum.com/.
Buntin, Seth - KATE wrote:> This code: > > <p> > > <label for="resource_type">Type</label><br/> > > <%= select(:resource, :type, %w{ Web Data }, { :include_blank => true > }) %> > > </p>i experienced the same error i changed :type into :status and then it works fine i think :type is not allowed in select -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I belive "type" is a method that returns the class of an Object and its now deprecated. So you wont be able to use it within your ror app. D. On Oct 9, 2006, at 7:02 PM, Adrian Liem wrote:> > Buntin, Seth - KATE wrote: >> This code: >> >> <p> >> >> <label for="resource_type">Type</label><br/> >> >> <%= select(:resource, :type, %w{ Web Data }, { :include_blank >> => true >> }) %> >> >> </p> > i experienced the same error > i changed :type into :status and then it works fine > i think :type is not allowed in select > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---