im learning rails and i got a error while writing a sample code. Script : ------- class GuestBookController < ActionController::Base def index @entry = GuestBook.find_all end def list_parameters params = request.parameters render :text=>"Parameters #{params}" end def list params = request.parameters @entry = GuestBook.new(params[:name]) @entry.save redirect_to :action => "index" end end ------------------------------------------------------------ i get the error " undefined method `stringify_keys!'' for "name1":String " while the list function is executed "name1" which i get in the error is the value which i gave for the field name. ------------------------------------------------------------ cud u help me to get rid of the error ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060309/e871c697/attachment.html
params is an already existing attribute, could give you some clashes...you might want to rename it... On Thursday, March 09, 2006, at 2:42 PM, dotnet java developer wrote:>im learning rails and i got a error while writing a sample code. > >Script : >------- > >class GuestBookController < ActionController::Base > def index > @entry = GuestBook.find_all > end > def list_parameters > params = request.parameters > render :text=>"Parameters #{params}" > end > > def list > params = request.parameters > @entry = GuestBook.new(params[:name]) > @entry.save > redirect_to :action => "index" > end >end > > >------------------------------------------------------------ > >i get the error " undefined method `stringify_keys!'' for "name1":String " >while the list function is executed > >"name1" which i get in the error is the value which i gave for the field >name. > >------------------------------------------------------------ > >cud u help me to get rid of the error ? > > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails >Mikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK) -- Posted with http://DevLists.com. Sign up and save your time!
Am Donnerstag, den 09.03.2006, 14:42 +0530 schrieb dotnet java developer:> im learning rails and i got a error while writing a sample code. > > Script : > ------- > class GuestBookController < ActionController::Base > def index > @entry = GuestBook.find_all > end > > def list_parameters > params = request.parameters > render :text=>"Parameters #{params}" > end > > def list > params = request.parameters > @entry = GuestBook.new(params[:name]) > @entry.save > redirect_to :action => "index" > end > end > > ------------------------------------------------------------ > > i get the error " undefined method `stringify_keys!'' for > "name1":String " while the list function is executed > > "name1" which i get in the error is the value which i gave for the > field name. > > ------------------------------------------------------------ > > cud u help me to get rid of the error ?The first line of your list method is redundant, because Rails already provides the request parameter hash in the variable (actual a method) params. Just drop this line. Maybe this solves it. You are not saying on wich line the error occurs, but i guess it is line two @entry = GuestBook.new(params[:name]), isn''t it? -- Norman Timmler http://blog.inlet-media.de