I need some help to debug an issue that just came up, and I''ve never seen before. I have a model, let''s call it Allocation, and it has worked in the past (is working now on the live server). It''s fairly simple with user_id, size, start (date), expire (date), storage_billing_id, timestamps. I started noticing in my development branch a couple of days ago that it won''t save. As I investigate further I see no errors when I attempt to save it just fails and return nil. in the console I tried:>> a = Allocation.new... # ...assigned all the attributes manually>> a.save=> nil>> a.valid?=> true>> a.frozen?=> false>> a.save!nil>> a.errors.full_messages=> [] I''ve removed some columns and added a column to this model recently, I''ve tampered with my os x rails installation recently, and I''ve done a lot of development around this class recently, but which of these issues is most likely the cause I don''t know. Any help debugging this would be GREATLY appreciated. Thanks, j --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2008-Nov-19 03:48 UTC
Re: model.save not committing to DB with no errors.
On Nov 18, 2008, at 6:04 PM, Joshua Kolden wrote:> > I need some help to debug an issue that just came up, and I''ve never > seen before. I have a model, let''s call it Allocation, and it has > worked in the past (is working now on the live server). It''s fairly > simple with user_id, size, start (date), expire (date), > storage_billing_id, timestamps. I started noticing in my development > branch a couple of days ago that it won''t save. As I investigate > further I see no errors when I attempt to save it just fails and > return nil. > > in the console I tried: > >>> a = Allocation.new > ... > # ...assigned all the attributes manually > >>> a.save > => nil >>> a.valid? > => true >>> a.frozen? > => false >>> a.save! > nil >>> a.errors.full_messages > => [] > > I''ve removed some columns and added a column to this model recently, > I''ve tampered with my os x rails installation recently, and I''ve done > a lot of development around this class recently, but which of these > issues is most likely the cause I don''t know. Any help debugging this > would be GREATLY appreciated.Any before_filters in place on this model? What does your development.log say? Do you see the INSERT query? --~--~---------~--~----~------------~-------~--~----~ 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 Nov 18, 7:48 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> > Any before_filters in place on this model? What does your > development.log say? Do you see the INSERT query?no before_filters (no filters of any kind). If I follow the development.log while I''m doing an interactive console like above I can see there is no output at all to the log when I do a save. If I immediately try a different model and save it, no problem, and I see some output in the dev log. It is very bazar. I keep thinking I must be using a keyword in the model somewhere, but I can''t find any. Maybe I''ve broken my installation. j --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-19 06:34 UTC
Re: model.save not committing to DB with no errors.
On Nov 19, 6:28 am, Joshua Kolden <crackcreat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 18, 7:48 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote: > > > > > Any before_filters in place on this model? What does your > > development.log say? Do you see the INSERT query? > > no before_filters (no filters of any kind). If I follow the > development.log while I''m doing an interactive console like above I > can see there is no output at all to the log when I do a save. If I > immediately try a different model and save it, no problem, and I see > some output in the dev log. It is very bazar. I keep thinking I must > be using a keyword in the model somewhere, but I can''t find any. Maybe > I''ve broken my installation. >Well if there''s something odd with that model you''ll have to show it before people can tell you what''s wrong. Tip of the day: methods/ associations called transaction are a bad thing. Fred> j--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 18, 10:34 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 19, 6:28 am, Joshua Kolden <crackcreat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 18, 7:48 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote: > > > > Any before_filters in place on this model? What does your > > > development.log say? Do you see the INSERT query? > > > no before_filters (no filters of any kind). If I follow the > > development.log while I''m doing an interactive console like above I > > can see there is no output at all to the log when I do a save. If I > > immediately try a different model and save it, no problem, and I see > > some output in the dev log. It is very bazar. I keep thinking I must > > be using a keyword in the model somewhere, but I can''t find any. Maybe > > I''ve broken my installation. > > Well if there''s something odd with that model you''ll have to show it > before people can tell you what''s wrong. Tip of the day: methods/ > associations called transaction are a bad thing. > > Fred >Haha how did you know? I had just found that out and came back here to post the solution. It turns out I have a model for financial transactions called.... you guessed it ''transaction''. Seemed to be working fine everywhere for a while then I created a polymeric association to the allocation model and I guess this line in the allocation model screwed it up. class Allocation < ActiveRecord::Base has_one :transaction, :as => :item ... Thanks, j --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 18, 10:34 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 19, 6:28 am, Joshua Kolden <crackcreat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 18, 7:48 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote: > > > > Any before_filters in place on this model? What does your > > > development.log say? Do you see the INSERT query? > > > no before_filters (no filters of any kind). If I follow the > > development.log while I''m doing an interactive console like above I > > can see there is no output at all to the log when I do a save. If I > > immediately try a different model and save it, no problem, and I see > > some output in the dev log. It is very bazar. I keep thinking I must > > be using a keyword in the model somewhere, but I can''t find any. Maybe > > I''ve broken my installation. > > Well if there''s something odd with that model you''ll have to show it > before people can tell you what''s wrong. Tip of the day: methods/ > associations called transaction are a bad thing. > > FredHaha, how did you know? I just figured it out and was on my way back here to post the solution. I have a model for financial transactions called.... you guess it ''transaction''. It''s been working fine for weeks, but I just added a polymorphic association from it to my Allocation model. It appears this was the culprit: class Allocation < ActiveRecord::Base has_one :transaction, :as => :item Thank you very much!! j --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---