Hello Everyone,
I am getting following error while updating the record. i.e I have “save draft” function so I am saving data while user click “save draft” using ajax and I will change the form as update and set message id and payment id in ajax success in hidden field. so page could not load, if user click again “save draft” button i am getting following error.
my params:
“message”=>{“user_id”=>“90”, “payment_info_attributes”=>{“id”=>“816”, “first_name”=>“test”, “last_name”=>“test”}, “card_type”=>“master”…
ActiveRecord::RecordNotFound (Couldn’t find PaymentInfo with ID=816 for Message with ID=89):
app/controllers/messages_controller.rb:280:in `update’
message controller
line 280: @message.update_attributes(params[:message])
message.rb
has_one :payment_info, :as => :paymentable, :dependent => :destroy
accepts_nested_attributes_for :payment_info
payment_info.rb
belongs_to :message
Both were created and I can see that both record in my database. i.e message 89 and payment info 816
Note: Its working locally but in staging its not working showing below error
Hello Everyone,
I am getting following error while updating the record. i.e I have “save draft” function so I am saving data while user click “save draft” using ajax and I will change the form as update and set message id and payment id in ajax success in hidden field. so page could not load, if user click again “save draft” button i am getting following error.
my params:
“message”=>{“user_id”=>“90”, “payment_info_attributes”=>{“id”=>“816”, “first_name”=>“test”, “last_name”=>“test”}, “card_type”=>“master”…
ActiveRecord::RecordNotFound (Couldn’t find PaymentInfo with ID=816 for Message with ID=89):
app/controllers/messages_controller.rb:280:in `update’
message controller
line 280: @message.update_attributes(params[:message])
message.rb
has_one :payment_info, :as => :paymentable, :dependent => :destroy
accepts_nested_attributes_for :payment_info
payment_info.rb
belongs_to :message
Both were created and I can see that both record in my database. i.e message 89 and payment info 816
Do you use the same database in staging that you use locally?
Hi Guys I think I find the solution.
Thanks for the reply.
Thats because my old data in nested form table(payment info).
Early I empty the Message table and forget to empty PaymentInfo table.
In my staging console i enter Message.find(89).payment_info, it bring wrong record instead of 816 payment record.
Now i deleted old data and look like working…
I dont know this is error.