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 --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, 2007-02-08 at 10:18 -0800, jack.tang wrote:> 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?---- 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 --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 9, 2:29 am, Craig White <c...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote:> On Thu, 2007-02-08 at 10:18 -0800, jack.tang wrote: > > 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? > > ---- > 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 caseCraig, thanks for your reminder! it works now :)> > Craig--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---