Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No raise even if raise_on_401 is set to true. #47

@takeshi0206

Description

@takeshi0206

ginjo-rfm-3.0.12
Rails 6.0.2.2

When executing the Find method, no exception is thrown if there is no such record.

sample code


Models / art.rb

class Art < Rfm::Base
  config :layout => 'English_Form_View',
   :host => "127.0.0.1",
   :port => 16020,
   :account_name => "admin",
   :password => "xxxxxxxx",
   :database => "FMServer_Sample",
   :raise_on_401 => true,
   :ssl => false
end


Controllers / art_controller.rb

class ArtController < ApplicationController
...
  def search
    begin
        @records = Art.find "TextForSearch" => params[:Search]
        flash[:notice] = Art.config[:raise_on_401]  # true
      end
    rescue Rfm::Error::NoRecordsFoundError
      flash[:notice] = "'#{params[:Search]}' could not be found.”
      @records = Art.all
    end
  end
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions