Select error


#1

This code:

Type

<%= select(:resource, :type, %w{ Web Data }, { :include_blank => true
}) %>

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: Resource General
4:
5:

Type

6: <%= select(:resource, :type, %w{ Web Data }, { :include_blank
=> true }) %>
7:


8:
9:

Focus

I took it straight out of the Agile Web D. book (except the
:include_blank)

Seth B.

Web Resources Coordinator

Kentucky Academy of Technology Education

Murray State University


#2

Buntin, Seth - KATE wrote:

This code:

Type

<%= select(:resource, :type, %w{ Web Data }, { :include_blank => true
}) %>

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 })


#3

Buntin, Seth - KATE wrote:

This code:

Type

<%= select(:resource, :type, %w{ Web Data }, { :include_blank => true
}) %>

i experienced the same error
i changed :type into :status and then it works fine
i think :type is not allowed in select


#4

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.