Sha256: f957255759ea7886712062b6cd065095a0389d47e07b9cdfd3d5a21a760db8cd

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

module OkuribitoRails
  class MethodCallLog < ActiveRecord::Base
    belongs_to :method_call_situation, counter_cache: :called_num

    validates :class_name, presence: true, length: { minimum: 1, maximum: 255 }
    validates :method_symbol, presence: true, inclusion: { in: %w(. #) }
    validates :method_name, presence: true, length: { minimum: 1, maximum: 255 }

    scope :with_class_name, ->(class_name) { where("class_name LIKE ?", "%#{class_name}%") }
    scope :with_method_name, ->(method_name) { where("method_name LIKE ?", "%#{method_name}%") }

    def self.search(args)
      mcl = self
      mcl = mcl.with_class_name(args[:class_name]) if args[:class_name].present?
      mcl = mcl.with_method_name(args[:method_name]) if args[:method_name].present?
      mcl
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
okuribito_rails-0.2.4 app/models/okuribito_rails/method_call_log.rb
okuribito_rails-0.2.3 app/models/okuribito_rails/method_call_log.rb