I have 2 models, entity and client. Entity has_one client and client belongs_to entity. Entity has attributes name and legal_name. Entity also has an unique index on (lower(name)). The pKey for both is the conventional Rails id. Client has a fKey constraint on entity_id and is indexed in entity_id. In controllers/clients_controller.rb I have: # GET /clients/new # GET /clients/new.xml def new @client = Client.new @entity = Entity.new respond_to do |format| # new.html.erb format.html { render :template => ''clients/edit.html.erb'' } format.xml { render :xml => @client } end end In models/entity.rb I have the following validation: validates_presence_of :entity_name, :message => "The name may not be blank. The file views/clients/edit.html.erb has the following code: <h1>Editing client <%= @entity.id unless @entity.new_record? %></h1> <%= error_messages_for :client %> <% form_for(@client) do |cu| %> <% fields_for @entity do |en| %> Name <%= en.text_field :entity_name %> <br />Legal name <%= en.text_field :entity_legal_name %> <br />Legal form <%= en.text_field :entity_legal_form %> <% end %> <br />Credit Policy <%= cu.text_field :client_credit_policy %> <br />Credit Terms <%= cu.text_field :client_credit_terms %> ... <p> <%= cu.submit "Update" if @client.active? %> </p> <% end %> <%= link_to ''Show'', @client %> | <%= link_to ''Back'', clients_path %> When I try and add a new client - entity pair with a blank name, instead of getting a nicely formated error on top of the entry page I get this: We''re sorry, but something went wrong. We''ve been notified about this issue and we''ll take a look at it shortly. and in the log I get this: Much SQL truncated ... ActiveRecord::RecordInvalid (Validation failed: Entity legal name The legal name may not be blank., Entity name The name may not be blank.): c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ validations.rb:946:in `save_without_transactions!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/database_statements.rb:66:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:80:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:100:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:120:in `rollback_active_record_state!'' ... Why am I not getting the default validation error displayed on the edit page? Thanks, X-POSTED Rails Forum -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Byrne wrote: I added <%= error_messages_for :entity %> to views/clients/edit.html.erb and get the same behaviour. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Byrne wrote:> When I try and add a new client - entity pair with a blank name, instead > of getting a nicely formated error on top of the entry page I get this:> Much SQL truncated > ... > ActiveRecord::RecordInvalid (Validation failed: Entity legal name The > legal name > may not be blank., Entity name The name may not be blank.):Can you show the truncated SQL? Also the parameters from the log file sent to the #update method and also the content of the #update method... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush wrote:> > Can you show the truncated SQL? Also the parameters from the log file > sent to the #update method and also the content of the #update method...Certainly: log/development.log Processing ClientsController#create (for 127.0.0.1 at 2008-03-08 15:55:12) [POST] Session ID: 8603979b1f6dcb80d723c29c0f7d7cf3 Parameters: {"commit"=>"Update", "entity"=>{"entity_legal_name"=>"", "entity_name"=>"", "entity_legal_form"=>""}, "client"=>{"changed_by"=>"", "created_by"=>"", "client_credit_policy"=>"CASH", "effective_from"=>"Sat Mar 08 15:53:45 -0500 2008", "client_date_last_active"=>"Sat Mar 08 15:53:45 -0500 2008", "client_date_last_contacted"=>"Sat Mar 08 15:53:45 -0500 2008", "superseded_after"=>"0", "changed_at"=>"", "client_credit_terms"=>"0", "created_at"=>""}, "authenticity_token"=>"f201af86310713a8221d5b50c569c4d757453283", "action"=>"create", "controller"=>"clients"} SQL (0.000000) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = ''clients''::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum Client Indexes (0.016000) SELECT i.relname, d.indisunique, a.attname FROM pg_class t, pg_class i, pg_index d, pg_attribute a WHERE i.relkind = ''i'' AND d.indexrelid = i.oid AND d.indisprimary = ''f'' AND t.oid = d.indrelid AND t.relname = ''clients'' AND a.attrelid = t.oid AND ( d.indkey[0]=a.attnum OR d.indkey[1]=a.attnum OR d.indkey[2]=a.attnum OR d.indkey[3]=a.attnum OR d.indkey[4]=a.attnum OR d.indkey[5]=a.attnum OR d.indkey[6]=a.attnum OR d.indkey[7]=a.attnum OR d.indkey[8]=a.attnum OR d.indkey[9]=a.attnum ) ORDER BY i.relname Client Indexes (0.000000) SELECT c2.relname, i.indisunique, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i WHERE c.relname = ''clients'' AND c.oid = i.indrelid AND i.indexrelid = c2.oid AND i.indisprimary = ''f'' AND i.indexprs IS NOT NULL ORDER BY 1 SQL (0.015000) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = ''entities''::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum Entity Indexes (0.000000) SELECT i.relname, d.indisunique, a.attname FROM pg_class t, pg_class i, pg_index d, pg_attribute a WHERE i.relkind = ''i'' AND d.indexrelid = i.oid AND d.indisprimary = ''f'' AND t.oid = d.indrelid AND t.relname = ''entities'' AND a.attrelid = t.oid AND ( d.indkey[0]=a.attnum OR d.indkey[1]=a.attnum OR d.indkey[2]=a.attnum OR d.indkey[3]=a.attnum OR d.indkey[4]=a.attnum OR d.indkey[5]=a.attnum OR d.indkey[6]=a.attnum OR d.indkey[7]=a.attnum OR d.indkey[8]=a.attnum OR d.indkey[9]=a.attnum ) ORDER BY i.relname Entity Indexes (0.000000) SELECT c2.relname, i.indisunique, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i WHERE c.relname = ''entities'' AND c.oid = i.indrelid AND i.indexrelid = c2.oid AND i.indisprimary = ''f'' AND i.indexprs IS NOT NULL ORDER BY 1 SQL (0.000000) BEGIN SQL (0.000000) ROLLBACK ActiveRecord::RecordInvalid (Validation failed: Entity legal name The legal name may not be blank., Entity name The name may not be blank.): c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:946:in `save_without_transactions!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' /app/controllers/clients_controller.rb:66:in `create'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/usr/lib/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66 c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 Redirected to http://localhost:3000/500.html client_controller.rb # POST /clients # POST /clients.xml def create @client = Client.new(params[:client]) @entity = Entity.new params[:entity] @entity.save! @client.entity_id = @entity.id @client.save! respond_to do |format| if @client.save flash[:notice] = ''Client was successfully created.'' format.html { redirect_to(@client) } format.xml { render :xml => @client, :status => :created, :location => @client } else format.html { render :action => "new" } format.xml { render :xml => @client.errors, :status => :unprocessable_entity } end end end # PUT /clients/1 # PUT /clients/1.xml def update @client = Client.find(params[:id]) unless @client.active? flash[:notice] =''You may not edit an inactive client'' return(redirect_to :action => ''edit'', :id => params[:id]) end respond_to do |format| if @client.update_attributes(params[:client]) flash[:notice] = ''Client was successfully updated.'' format.html { redirect_to(@client) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @client.errors, :status => :unprocessable_entity } end end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Byrne wrote:> <%= error_messages_for :client %> > > <% form_for(@client) do |cu| %> > <% fields_for @entity do |en| %> > Name <%= en.text_field :entity_name %> > <br />Legal name <%= en.text_field :entity_legal_name %> > <br />Legal form <%= en.text_field :entity_legal_form %> > <% end %> > > > X-POSTED Rails ForumName <%= en.text_field :entity_name %> should be something like: Name <%= en.text_field :name %> hth p.s. a great way to debug this is to stick a debugger statement at the top of your controller method, gem install ruby-debug and then start your mongrel server like this: script/server webrick -u or if you don''t have mongrel.. What.. you don''t have mongrel????!!!! hth ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ilan Berci wrote:> > Name <%= en.text_field :entity_name %> > > should be something like: > > Name <%= en.text_field :name %> >I do not think so. The attribute is indeed entity_name for in the migration I have: class CreateEntities < ActiveRecord::Migration def self.up create_table :entities do |t| t.string :entity_name, :null => false, :limit => 30 t.string :entity_legal_name, :null => false, :limit => 120 t.string :entity_legal_form, :null => false, :limit => 4 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Byrne wrote:> I do not think so. The attribute is indeed entity_name for in the > migration I have: >James Byrne wrote:> I do not think so. The attribute is indeed entity_name for in the > migration I have:Whoops.. you are right, my bad! I still believe however that the data is not coming into your controllers correctly so the missing fields trip your validators. I would just debug it as I suggested above and the error will come screaming out at you.. ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ilan Berci wrote:> James Byrne wrote: > >> I do not think so. The attribute is indeed entity_name for in the >> migration I have: >> > > James Byrne wrote: > >> I do not think so. The attribute is indeed entity_name for in the >> migration I have: > > Whoops.. you are right, my bad! I still believe however that the data > is not coming into your controllers correctly so the missing fields trip > your validators. >Well, perhaps I did not make myself clear to begin with. I am testing the validators and so the data is indeed missing. The problem I am having here is that the flash notice is not displaying on the edit page as I expect. This code is at a very rudimentary stage and there are a number of intricate dependencies that I have yet to code. So I am taking care that all the straight-forward error handling is working as I expect and that my assumptions are checked against reality at an early stage. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ilan Berci wrote:> p.s. a great way to debug this is to stick a debugger statement at the > top of your controller method, gem install ruby-debug and then start > your mongrel server like this: script/server webrick -u >Thanks for the heads up on this. I have installed it and found a decent write up on it at: http://blog.nanorails.com/articles/2006/07/14/a-better-rails-debugger-ruby-debug> or if you don''t have mongrel.. What.. you don''t have mongrel????!!!!Nope. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I was poking around in the controllers/application.rb and removed (commented) some code thus: # def rescue_action(exception) # if exception.class.to_s == ''ActionController::RoutingError'' # logger.error "404 #{exception}" # @pageTitle = ''Not found'' # redirect_to ''/404.html'' # # render :template => ''frontpage/render_404'', :layout => ''standard'', # # :status => ''404 Not found'' # # unless ENV[''RAILS_ENV''] == ''production'' or request.env[''REQUEST_URI''] == ''/test_404'' # # bb_log "Dumping call stack at 404: #{request.env[''REQUEST_URI'']}\n"+caller.join("\n ") # # end # else # log_error(exception) # # if ENV[''RAILS_ENV''] == ''production'' or local_request? == false # ExceptionMailer.deliver_kaboom(exception, self, request) # end # @exception = exception # @pageTitle = "Unexpected error" # message = ''500 Internal error: Support has been notified'' # render :template => ''frontpage/render_500'', :layout => ''standard'', # :status => message # redirect_to ''/500.html'' # end # end Now the validation failure reports this in the browser: ActiveRecord::RecordInvalid in ClientsController#create Validation failed: Entity legal name The legal name may not be blank., Entity name The name may not be blank. RAILS_ROOT: C:/Documents and Settings/byrnejb/My Documents/My Projects/ca.harte-lyne.system/proforma Application Trace | Framework Trace | Full Trace c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:946:in `save_without_transactions!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' app/controllers/clients_controller.rb:68:in `create'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:946:in `save_without_transactions!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/usr/lib/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66 c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:946:in `save_without_transactions!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:112:in `save!'' app/controllers/clients_controller.rb:68:in `create'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/usr/lib/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'' c:/usr/lib/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in `dispatch'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66 c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/usr/lib/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/usr/lib/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 Request Parameters: {"commit"=>"Update", "entity"=>{"entity_legal_name"=>"", "entity_name"=>"", "entity_legal_form"=>""}, "authenticity_token"=>"f201af86310713a8221d5b50c569c4d757453283", "client"=>{"changed_by"=>"", "created_by"=>"", "client_credit_policy"=>"CASH", "effective_from"=>"Sat Mar 08 17:20:55 -0500 2008", "client_date_last_active"=>"Sat Mar 08 17:20:55 -0500 2008", "client_date_last_contacted"=>"Sat Mar 08 17:20:55 -0500 2008", "superseded_after"=>"0", "changed_at"=>"", "client_credit_terms"=>"0", "created_at"=>""}} Show session dump --- flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} but when I try to view the backtrace I get this: No route matches "/Application-Trace" with {:method=>:get} My routes,rb says this: # The routes table below is a waerfall implementation and # the first URI matched is taken. ActionController::Routing::Routes.draw do |map| map.resources :clients # map.connect ''/clients/:id/deactivate'', # :controller => ''clients'', # :action => ''deactivate'', # :requirements => { :id => /\d+/ } # map.connect ''clients/e/:entity_id'', # :controller => ''clients'', # :action => ''edit_from_entity'' # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # map.connect ''products/:id'', :controller => ''catalog'', :action => ''view'' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # map.purchase ''products/:id/purchase'', :controller => ''catalog'', # :action => ''purchase'' # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # map.resources :products # Sample resource route with options: # map.resources :products, # :member => { :short => :get, :toggle => :post }, # :collection => { :sold => :get } # Sample resource route with sub-resources: # map.resources :products, # :has_many => [ :comments, :sales ], :has_one => :seller # Sample resource route within a namespace: # map.namespace :admin do |admin| # # Directs /admin/products/* to # Admin::ProductsController (app/controllers/admin/products_controller.rb) # admin.resources :products # end # You can have the root of your site routed with map.root -- just # remember to delete public/index.html. # map.root :controller => "welcome" # See how all your routes lay out with "rake routes" # Install the default routes as the lowest priority. map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' end Any guidance is appreciated. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---