Vincent Foley
2005-Apr-12 20:45 UTC
method_missing gsub! for a Time instance when #save is called
Hi, I have a weird problem, when I try to create a new record and I call job.save, I get this error message: <snip> NoMethodError in Jobs#create private method `gsub!'' called for Tue Apr 12 16:39:59 EDT 2005:Time app/controllers/jobs_controller.rb:55:in `create'' script/server:48 </snip> Here''s the action that is being called: def create job = Job.new job.attributes = @params["job"] job.technicians << Technician.find(@params["techs"]) if job.save redirect_to "list" else render_text "Error!" end end It looks fine to me, doesn''t it? I inserted the line render_text "<pre>#{job.to_yaml}</pre>" before the job.save line, and here''s the output: --- !ruby/object:Job attributes: created_on: cost: "0" time: 0 title: Say good-bye modified_on: priority_id: "3" client: Everyone finished_on: deadline: 2005-04-15 description: Say goodbye to my co-workers category_id: "1" phone: N/A finished: 0 new_record: true technicians: - !ruby/object:Technician attributes: username: vince id: "1" phone: "(450) 601-6418" first_name: Vincent password: pomme last_name: Foley email: vfoley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Is there something wrong with created_on or modified_on? Their type in the table is Date (not DateTime). Thanks for the help guys. -- Vincent Foley-Bourgon Blog: http://www.livejournal.com/~gnuvince World.run while (6 * 9 == 42)
Dave Lee
2005-Apr-12 21:33 UTC
Re: method_missing gsub! for a Time instance when #save is called
Vincent Foley <vfoley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a weird problem, when I try to create a new record and I call > job.save, I get this error message: > > <snip> > NoMethodError in Jobs#create > > private method `gsub!'' called for Tue Apr 12 16:39:59 EDT 2005:Timethe problem will be fixed in the next release. see http://dev.rubyonrails.com/ticket/985 Dave