I have a legacy schema (that I cannot change) that I am working with, building a quick maintenance front end using Rails. The problem is that when I process the Update nothing happens on the Oracle system. All the trace logs indicate the right SQL is being generated and called, but nada happens in Oracle. I am trying to start simple and update a single column: network_id. If you look at the logging data you can see the SQL update seems proper, with the old value and new value
OLD - network_id = 'sarB555' NEW - network_id = 'sarB333'
Running on Window, Ruby 1.8.6, Rails 1.2.6, Oracle 10G
Any suggestions would be appreciated. Thanks. Mike
Here is some code:
=== # MODEL - The object I'm trying to update class ClientDetail < ActiveRecord::Base
cattr_reader :per_page @@per_page = 20
set_table_name "CLIENT_DETAILS" set_primary_key "CLIENT_DETAILS_ID"
# Relationships has_many :client_state, :class_name => 'ClientState', :foreign_key => "CLIENT_DETAILS_ID"
# Reference Data values to get descriptions belongs_to :user_type, :foreign_key => "USER_TYP_ID" belongs_to :presence_type, :foreign_key => "PRESENCE_TYP_ID" belongs_to :presence_device_type, :foreign_key => "PRESENCE_DEVICE_TYP_ID" belongs_to :provider, :foreign_key => "PROVIDER_ID" end
=== # CONTROLLER methods #Load the rhtml page def edit_client_details @page_title = 'Update Client Detail ' @current_client_detail = ClientDetail.find(params[:id]) end
# Save the updated network_id def save_client_detail_changes @current_client_detail = ClientDetail.find(params[:id]) newNetworkId = params[:current_client_detail][:network_id] if @current_client_detail.update_attributes(params[:network_id]) @current_client_detail.update_attribute(:network_id, newNetworkId)
#Ive tried using this, does not work. #@current_client_detail.network_id=newNetworkId
begin @current_client_detail.save! rescue puts '-- EEEEEEEEEEEEEEE Exception of some kind.' end flash[:notice] = 'Client Details was successfully updated.' redirect_to :action => 'search_for_puids' else render :action => 'edit_client_details' end #redirect_to :action => 'search_for_puids' end
=== # LOGGING OUTPUT -------------- START #save_client_detail_changes - param[:id] : 121 ============ #save_client_detail_changes - @current_client_detail: #<ClientDetai l:0x59355f8> ============ #save_client_detail_changes - params[:network_id] - ============ #save_client_detail_changes - params[:current_client_detail][:netwo rk_id] - sarB333 update_attributes for network Id happening ------------ Old Value: sarB555 ------------ New Value: sarB333 127.0.0.1 - - [07/Feb/2008:12:02:53 Mountain Standard Time] "POST / client_detail
Processing ClientDetailsNgsController#save_client_detail_changes (for 127.0.0.1 at 2008-02-07 12:02:53) [POST] Session ID: 18cf528d3d578158af255b0df5037b49 Parameters: {"commit"=>"Edit", "action"=>"save_client_detail_changes", "id"=>"121", "controller"=>"client_details_ngs", "current_client_detail"=>{"network_id"=>"sarB333"}} e[4;35;1mClientDetail Columns (0.000000)e[0m e[0m select column_name as name, data_type as sql_type, data_default, nullable, decode(data_type, 'NUMBER', data_precision, 'FLOAT', data_precision, 'VARCHAR2', data_length, 'CHAR', data_length, null) as limit, decode(data_type, 'NUMBER', data_scale, null) as scale from all_tab_columns where owner = 'SOMEUSER' and table_name = 'CLIENT_DETAILS' order by column_id e[0m e[4;36;1mClientDetail Load (0.015000)e[0m e[0;1mSELECT * FROM CLIENT_DETAILS WHERE (CLIENT_DETAILS."CLIENT_DETAILS_ID" = '121') e[0m e[4;35;1mClientDetail Update (0.016000)e[0m e[0mUPDATE CLIENT_DETAILS SET presence_typ_id = 1.0, network_id = 'sarB555', client_details_id = 121, provider_id = 16.0, alt_user_typ_id = 1.0, public_user_id = '3031111111', pres_device_id = 'a283423334335', pres_device_address = NULL, reg_step_typ_id = NULL, user_typ_id = 3.0, presence_contxt = NULL, auth_id = NULL, alt_public_user_id = '3032222222', presence_device_typ_id = 3.0, auth_scheme = NULL WHERE "CLIENT_DETAILS_ID" = NULLe[0m e[4;36;1mClientDetail Update (0.016000)e[0m e[0;1mUPDATE CLIENT_DETAILS SET presence_typ_id = 1.0, network_id = 'sarB333', client_details_id = 121, provider_id = 16.0, alt_user_typ_id = 1.0, public_user_id = '3031111111', pres_device_id = 'a283423334335', pres_device_address = NULL, reg_step_typ_id = NULL, user_typ_id = 3.0, presence_contxt = NULL, auth_id = NULL, alt_public_user_id = '3032222222', presence_device_typ_id = 3.0, auth_scheme = NULL WHERE "CLIENT_DETAILS_ID" = NULLe[0m e[4;35;1mClientDetail Update (0.000000)e[0m e[0mUPDATE CLIENT_DETAILS SET presence_typ_id = 1.0, network_id = 'sarB333', client_details_id = 121, provider_id = 16.0, alt_user_typ_id = 1.0, public_user_id = '3031111111', pres_device_id = 'a283423334335', pres_device_address = NULL, reg_step_typ_id = NULL, user_typ_id = 3.0, presence_contxt = NULL, auth_id = NULL, alt_public_user_id = '3032222222', presence_device_typ_id = 3.0, auth_scheme = NULL WHERE "CLIENT_DETAILS_ID" = NULLe[0m Redirected to http://localhost:3000/client_details_ngs/search_for_puids Completed in 0.17200 (5 reqs/sec) | DB: 0.04700 (27%) | 302 Found [http://localhost/client_details_ngs/save_client_detail_changes/121\]