Skip to content

Instantly share code, notes, and snippets.

@ankit8898
Last active December 15, 2015 05:59
Show Gist options
  • Save ankit8898/5212677 to your computer and use it in GitHub Desktop.
Save ankit8898/5212677 to your computer and use it in GitHub Desktop.
Error
Controller Update
def update
@channel = Channel.find(params[:id])
@channel.attributes = params[:channel]
if @channel.save! #@channel.update_attributes(params[:channel])
redirect_to @channel, notice: 'Channel was successfully updated.'
else
render action: 'edit'
end
end
Error Log
Processing by ChannelsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"LneNpGZw5NG4cr71ZYY0yWj/3w70BJhPpBpwV502i2k=", "channel"=>{"channel_name"=>"National Agentsas", "internal_flag"=>"Y", "multiple_inventory_clusters"=>"Y", "multiple_inventory_trans_types"=>"Y", "channel_mappings_attributes"=>{"0"=>{"src_channel"=>"INDIRECT_AGENT", "channel_name"=>"National Agents", "src_file_type"=>"INVENTORY", "id"=>"INDIRECT_AGENT"}, "1"=>{"src_channel"=>"Charlie", "channel_name"=>"National Agents", "src_file_type"=>"BID", "id"=>"Charlie"}}}, "commit"=>"Update Channel", "id"=>"2"}
Channel Load (2.0ms) SELECT "channels".* FROM "channels" WHERE "channels"."id" = 2 LIMIT 1
ChannelMapping Load (0.0ms) SELECT "channel_mappings".* FROM "channel_mappings" WHERE "channel_mappings"."channel_name" = 'National Agentsas' AND "channel_mappings"."src_channel" IN ('INDIRECT_AGENT', 'Charlie')
An error occurred while [App Name] Exception - channels-update:
Type: ActiveRecord::RecordNotFound
Message: Couldn't find ChannelMapping with ID=INDIRECT_AGENT for Channel with ID=2
Backtrace:
/Users/ankitgupta/.rvm/gems/jruby-1.7.3/gems/activerecord-3.2.13/lib/active_record/nested_attributes.rb:463:in `raise_nested_attributes_record_not_found'
/Users/ankitgupta/.rvm/gems/jruby-1.7.3/gems/activerecord-3.2.13/lib/active_record/nested_attributes.rb:428:in `assign_nested_attributes_for_collection_association'
org/jruby/RubyArray.java:1613:in `each'
/Users/ankitgupta/.rvm/gems/jruby-1.7.3/gems/activerecord-3.2.13/lib/active_record/nested_attributes.rb:401:in `assign_nested_attributes_for_collection_association'
/Users/ankitgupta/.rvm/gems/jruby-1.7.3/gems/activerecord-3.2.13/lib/active_record/nested_attributes.rb:295:in `channel_mappings_attributes='
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment