app/controllers/admin/cms_controller.rb
def create

    # Can we do this?
    not_found and return unless action_allowed?( :create )

    # load the content
    extract_content( true )
    generate_titles( :new )

    # try to save it
    if @content.save

      respond_after_action( :create, :created )

    else

      # it failed: so show a flash + redisplay the form
      flash.now[:error] = status_t( @content, :create_failed )
      render( action: :new )

    end

  end
# Callback from the #new method: attempts to save a new item to the database.
Callback from the #new method: attempts to save a new item to the database.
Callback from the #new method : attempts to save a new item to the database .
def create
    not_found and return unless action_allowed?( :create )
    extract_content( true )
    generate_titles( :new )
    if @content.save
      respond_after_action( :create, :created )
    else
      flash.now[:error] = status_t( @content, :create_failed )
      render( action: :new )
    end
  end
def create not_found and return unless action_allowed? ( :create ) extract_content ( true ) generate_titles ( :new ) if @content . save respond_after_action ( :create , :created ) else flash . now [ :error ] = status_t ( @content , :create_failed ) render ( action : :new ) end end
Callback from the #new method: attempts to save a new item to the database.
Callback from the #new method : attempts to save a new item to the database .
# Can we do this? # load the content # try to save it # it failed: so show a flash + redisplay the form