One question on select tag

Hi

I am now trying to learn some rails tag and encounter one question on
“select” tag.

== Controller

def post_book
@book = Book.new(:type => “CS”)
end

== Viewer

<%=select “book”, “type”, [
[" tale", “T”],
[“computer science” ,“CS”]…
],
{…}
%>
When I open the page xxx/yyy/post_book, it throws exception: wrong
argument type String (expected Module). And the exception occured line
number is the “select” tag. So could you please tell me how to solve
the problem?

– jack

On Thu, 2007-02-08 at 10:18 -0800, jack.tang wrote:

number is the “select” tag. So could you please tell me how to solve
the problem?


I don’t recall ever setting values that way but I don’t always do
shortest code…

def post_book
@book = Book.new
@book.type = “CS”
end

but I wonder if ‘type’ is a bad name for a field (reserved word?) and
would probably use btype or book_type just in case

Craig

On Feb 9, 2:29 am, Craig W. [email protected] wrote:

end
argument type String (expected Module). And the exception occured line
end

but I wonder if ‘type’ is a bad name for a field (reserved word?) and
would probably use btype or book_type just in case

Craig, thanks for your reminder! it works now :slight_smile: