Sha256: ade0e7187cd0dd8825411d6cddd7c0dd3c87b1d4cee434ba3bb21d46dc4b8535
Contents?: true
Size: 681 Bytes
Versions: 3
Compression:
Stored size: 681 Bytes
Contents
module KepplerFrontend class ViewCallback < ApplicationRecord belongs_to :view validate :uniqueness_callback def set_function_types [:before_action, :before_filter, :after_action, :after_filter] end def set_callbacks callbacks = KepplerFrontend::CallbackFunction.all.map callbacks.map { |v| [v.name, v.name] } end def callback_exists? callback = ViewCallback.where( function_type: self.function_type, name: self.name, view_id: self.view.id ) callback.count == 0 ? false : true end private def uniqueness_callback errors.add(:name) if callback_exists? end end end
Version data entries
3 entries across 3 versions & 1 rubygems