Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6785011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:04:17+00:00 2026-05-26T17:04:17+00:00

The rails 3 appis is using the create! method inside the create of a

  • 0

The rails 3 appis is using the create! method inside the create of a controller.

Sometimes it works, and sometimes it does not.It fails consistently with always the same use case, however i have checked and rechecked and cannot understand why it fails.

The create! method fails silently, there is no indication on the logs of the problem. How can I make the create! methode more verbose?

Code :

class NotificationPaiementsController < ApplicationController
  protect_from_forgery :except =>[:create]
  skip_before_filter :authorize, :only => [:create]

  def create
    logger.debug "params is #{params}"
    logger.debug "invoice is #{params[:invoice]}"
    logger.debug "payment_status is #{params[:payment_status]}"

    logger.debug "txn_id is #{params[:txn_id]}"

    @notification_paiement = NotificationPaiement.create!(:params => params,
                                              :cart_id => params[:invoice],
                                              :status=> params[:payment_status],
                                              :transaction_id => params[:txn_id])

    logger.debug "notification_paiement is #{@notification_paiement}"
    render :nothing=>true
  end
end

EDIT:
Thx for your answers, it would have been faster to catch exception, but i managed to identify the problem using new and savevia the console. At the save i had an error about UTF-8 encoding : ArgumentError: invalid byte sequence in UTF-8.
Paypal was changing “molière” in “moli\xE8re” and the error was never displayed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:04:18+00:00Added an answer on May 26, 2026 at 5:04 pm

    The create! constructor raises an exception if it fails:

    Creates an object just like Base.create but calls save! instead of save so an exception is raised if the record is invalid.

    So, if you’re going to use create!, you should wrap it in exception handling:

    begin
      @notification_paiement = NotificationPaiement.create!(...
    rescue ActiveRecord::RecordInvalid => e
      # Deal with your errors.
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started using coffeescript with Rails and I am finding that sometimes
I have a medium-complex Rails app. The main controller (the one that does what
I want to create an open source banner/advertising management app using Rails. The app
I don't know what I've broken but I can't create any rails apps using
I'd like to have some rails apps over different servers sharing the same session.
I just released a Rails app in Dreamhost and I'm using Google Apps for
http://localhost:3000/genre I'm using Instant Rails, I'm introducing scaffolding for the first time ever. So
I am using Capybara in combination with rspec for integration testing of rails apps.
I noticed that a rails plug-in I am using has had several fixes made
I create controller with InherritedResource class AppsController < InheritedResources::Base belongs_to :company # Devise before_filter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.