English 中文(简体)
是否有办法确定在铁路应用中的RoLSBACK数据库为何?
原标题:Is there a way to identify why the database ROLLSBACK in a Rails application?

我试图更新一个模范物体,并不断退缩。 Occassionaly抗议,认为这是一个验证错误。 但它没有指出实际失败。

最后,我试图删除这个词,但在删除时,它仍然未能确认。

是否有办法阻止这种情况,并确切地发现造成这种情况的原因和原因?

增 编

对更新或删除的典型答复:

ActiveRecord::RecordNotSaved: ActiveRecord::RecordNotSaved
from /data/HQ_Channel2/releases/20111011173855/vendor/rails/activerecord/lib/active_record/base.rb:2551:in `save_without_validation! 
from /data/HQ_Channel2/releases/20111011173855/vendor/rails/activerecord/lib/active_record/validations.rb:1019:in `save_without_dirty! 
from /data/HQ_Channel2/releases/20111011173855/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions! 
from /data/HQ_Channel2/releases/20111011173855/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save! 
from /data/HQ_Channel2/releases/20111011173855/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction 

更有证据的是,在我试图制造一个新物体时,这偏离了 app:

Processing OrganizationsController#create (for 127.0.0.1 at 2011-10-12 15:43:02) [POST]
  Parameters: {"commit"=>"submit", "action"=>"create", "authenticity_token"=>"QxTT80hdtULmkt7PeUH5MG+BZ/5l+a22ry3EL49q1V8=", "controller"=>"organizations", "organization"=>{"city"=>"lkjlkj", "name"=>"asdfa", "contact_24"=>"1", "zip"=>"123123", "quick_description"=>"2342, 123, 3,2423, 2", "url"=>"www.martini494bistro.com/", "hq_url"=>"12341234", "map_it"=>"1", "street"=>"lkjlkj", "phone_work"=>"123123123123", "is_authorized"=>"1", "state"=>"NJ"}}
  User Columns (2.2ms)   SHOW FIELDS FROM `users`
  User Load (4.4ms)   SELECT * FROM `users` WHERE (`users`.`persistence_token` =  77ca6dea2961c5102be62d8e995e3f4bfdcb5bcfdf64a4e8361d2f3b49e9b377e6467d1a01a3fbe7fc6dab76382220b044d3782f6045130a2de047d8b8f0bd87 ) LIMIT 1
  SQL (0.1ms)   BEGIN
  User Update (0.3ms)   UPDATE `users` SET `updated_at` =  2011-10-12 19:43:02 , `perishable_token` =  YP8Ivses9OgR6LtrNBvF , `last_request_at` =  2011-10-12 19:43:02  WHERE `id` = 2953
  Solr Update (7.0ms)   <?xml version="1.0" encoding="UTF-8"?><add><doc><field name="type">User</field><field name="type">ActiveRecord::Base</field><field name="id">User 2953</field><field name="email_s">asdfasdf@asdfasdf.com</field><field name="name_s">asdfadsf adfasdf</field><field name="first_name_s">asdfadsf</field><field name="created_at_d">2011-10-12T19:39:36Z</field><field name="class_name">User</field><field name="last_name_s">adfasdf</field><field name="name_text">asdfadsf adfasdf</field><field name="email_text">asdfasdf@asdfasdf.com</field><field name="last_name_text">adfasdf</field><field name="first_name_text">asdfadsf</field></doc></add>
  SQL (0.6ms)   COMMIT
  SQL (1.1ms)   SHOW TABLES
  Organization Columns (5.4ms)   SHOW FIELDS FROM `organizations`
  Organization Load (2.9ms)   SELECT `organizations`.* FROM `organizations` INNER JOIN `organizations_users` ON `organizations`.id = `organizations_users`.organization_id WHERE ((`organizations_users`.user_id = 2953)) 
  SQL (0.1ms)   BEGIN
  Organization Load (1.1ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`name`) = BINARY  asdfa ) LIMIT 1
  Organization Load (2.2ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`hq_url`) = BINARY  12341234 ) LIMIT 1
  QuickFact Columns (1.3ms)   SHOW FIELDS FROM `quick_facts`
  SQL (2.2ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  SQL (0.1ms)   ROLLBACK
  SQL (3.1ms)   BEGIN
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`name`) = BINARY  asdfa ) LIMIT 1
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`hq_url`) = BINARY  12341234 ) LIMIT 1
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  SQL (0.1ms)   ROLLBACK
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`name`) = BINARY  asdfa ) LIMIT 1
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`hq_url`) = BINARY  12341234 ) LIMIT 1
  SQL (0.1ms)   BEGIN
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`name`) = BINARY  asdfa ) LIMIT 1
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`hq_url`) = BINARY  12341234 ) LIMIT 1
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  SQL (0.1ms)   ROLLBACK
  SQL (0.1ms)   BEGIN
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`name`) = BINARY  asdfa ) LIMIT 1
  CACHE (0.0ms)   SELECT `organizations`.id FROM `organizations` WHERE (LOWER(`organizations`.`hq_url`) = BINARY  12341234 ) LIMIT 1
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  SQL (0.1ms)   ROLLBACK
Rendering template within layouts/application
Rendering organizations/new
Rendered organizations/_form (4.2ms)
Rendered layouts/_head (2.7ms)
  SQL (0.7ms)   SELECT count(*) AS count_all FROM `organizations` INNER JOIN `organizations_users` ON `organizations`.id = `organizations_users`.organization_id WHERE ((`organizations_users`.user_id = 2953)) 
Rendered layouts/_login_status_new (2.1ms)
Rendered layouts/_header_new (2.9ms)
Rendered layouts/_need_login (0.2ms)
Rendered layouts/_already_have_tooltip (0.1ms)
Completed in 227923ms (View: 34, DB: 29) | 200 OK [http://localhost/organizations]
  SQL (0.1ms)   SET NAMES  utf8 
  SQL (0.1ms)   SET NAMES  utf8 
  SQL (0.1ms)   SET SQL_AUTO_IS_NULL=0


Processing DynamicStylesheetsController#image_css to css (for 127.0.0.1 at 2011-10-12 15:46:50) [GET]
  Parameters: {"format"=>"css", "action"=>"image_css", "controller"=>"dynamic_stylesheets"}
最佳回答

gues:

  SQL (2.2ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  CACHE (0.0ms)   SELECT count(*) AS count_all FROM `quick_facts` WHERE (`quick_facts`.organization_id = NULL) 
  SQL (0.1ms)   ROLLBACK

.. mean that you have a uniqueness validation that s failing because the null value is "taken".

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签