hi i am new to ruby,i have a problem with drop down list where i can select an item and the selected item should be save in the database. But when i select the item its option values is saving in the database. please help here is the code: <table><td><tr><p><label for="content_category">category</label><br/> <%= select_tag ''category'', options_for_select([[''3MONTHS'', 0], [''6MONTHS'', 1],[''9MONTHS'', 2], [''12MONTHS'', 3]], 0), :onchange => "content.category(this,notnull );" %><br/> And in controller i have write like this: def create @content = Content.new(params[:content]) @content.category= @params[:category].to_s if @content.save flash[:notice] = ''Content was successfully created.'' redirect_to :action => ''list'' else render :action => ''new'' end end -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Dilip Bv wrote:> hi > i am new to ruby,i have a problem with drop down list where i can select > an item and the selected item should be save in the database. But when i > select the item its option values is saving in the database. please help > here is the code: > <table><td><tr><p><label > for="content_category">category</label><br/> > <%= select_tag ''category'', options_for_select([[''3MONTHS'', 0], > [''6MONTHS'', 1],[''9MONTHS'', 2], [''12MONTHS'', 3]], 0), :onchange => > "content.category(this,notnull );" %><br/> > >del all the option values. ...options_for_select([''3MONTHS'',''6MONTHS'', ''9MONTHS'',''12MONTHS''])... -- 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?hl=en -~----------~----~----~----~------~----~------~--~---