search for: recordnotsaved

Displaying 10 results from an estimated 10 matches for "recordnotsaved".

2013 Mar 07
1
Should ActiveRecord::RecordNotSaved attach the record in question?
I''m doing some work where I want to rescue ActiveRecord::RecordNotSaved from a save! call nested deep in the code. The thing is there could theoretically be failures here I want to pass through, and I want to inspect the record in order to decide. I figure a custom initializer on the exception class and a couple quick patches here and there in the code would make...
2006 Jul 19
6
ActiveRecord::RecordNotSaved - bizarre behaviour.
Hi. I get a RecordNotSaved exception when trying to create a user record. The error: User Columns (0.005930) SHOW FIELDS FROM users SQL (0.000465) BEGIN SQL (0.000466) COMMIT ActiveRecord::RecordNotSaved (ActiveRecord::RecordNotSaved): ... As you can see, there''s no INSERT SQL generated, which is...
2007 Mar 26
2
Strange Record not saved errors
I have a site with an acts_as_authenticated based login which has started throwing up some strange errors. Until a few days ago everything worked fine but all of a sudden ''RecordNotSaved'' errors are popping up in my logs. When I check the database, it looks like the record _is_ saved but I think users get an error so I''m starting to see a lot of double/triple entries for the same user. It doesn''t happen all the time and I can''t really reproduce...
2006 Aug 17
2
validates_associated bug?
...credit_card]) credit_card_validated = @credit_card.save @organization.credit_card = @credit_card end begin User.transaction do if @user.save! and #((has_credit_card and @credit_card.save!) or true) and (credit_card_validated and true or raise ActiveRecord::RecordNotSaved) and @organization.save! and @business_user.save! flash[:notice] = ''Account created. Check your email for login details.'' Mailer::deliver_signup_confirmation(@user) redirect_to :controller => ''login'', :action => ''lo...
2007 Oct 26
5
specing rescue, ensure and else blocks of an Exception
Greetings, I''m using rspec with rcov for my applications and there is one issue which I cannot solve nor can find any proper information regarding it: specing what is in a rescue block in case of an exception. I''m using Ruby on Rails and I usually make use of exceptions in my controllers, like the following example: def action @foo = Foo.find(1)
2007 Apr 05
0
unexpected behavior of before_validation
Today I found these comments in active record''s callbacks.rb file: # If the returning value of a before_validation callback can be evaluated to false, the process will be aborted and Base#save will return false. # If Base#save! is called it will raise a RecordNotSave error. # Nothing will be appended to the errors object. This caused me a lot of frustration earlier when I was
2008 Mar 14
15
Is anyone running Rails 2.x against a MS SQL Server DB?
I am unable to get ActiveRecord session support to work under 2.x against a SQL Server database. I''m starting to wonder if anyone is running 2.x against SQL Server? Is anyone running under the following configuration: Rails 2.x SQL Server 2000 DB (using AR adapter in ODBC mode) AR store for ActionController session store. I''d like to chat with you if you are. Thanks, Wes --
2009 Feb 10
2
rescue_from for NoMethodError
Hi everyone, I was just trying to catch some exceptions in my app, for "Record Not Found" I used this in my application.rb file rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found rescue_from ActionController::NoMethodError, :with => :show_error private def record_not_found render :text => "404 Not Found", :status =>
2009 Mar 17
4
Preventing a submitted hash from ActiveRecord DB store
Hi all, I have a multi model form (Project with many tasks) and I want to prevent a task from being saved to the DB if it is empty ie. if there is no i/p for that task from the user. I tried the following class Task < ActiveRecord::Base before_save :check_if_empty ... def check_if_empty self.destroy if description.blank? end but i get this TypeError in ProjectsController#create
2007 Aug 31
48
Deprecating the mocking framework?
I saw in one of Dave C.''s comments to a ticket that "our current plan is to deprecate the mocking framework." I hadn''t heard anything about that, but then again I haven''t paid super close attention to the list. Are we planning on dumping the mock framework in favor of using Mocha (or any other framework one might want to plug in?). Pat