Sha256: 14dacb05b135ab2a3988964654456df7efb057dfcbf5c3344985f9f1653085dd
Contents?: true
Size: 874 Bytes
Versions: 3
Compression:
Stored size: 874 Bytes
Contents
# frozen_string_literal: true module RespondForHelper module Formats class Base attr_reader :controller delegate :request, :respond_to, :render, :head, :redirect_to, :flash, :url_for, :action_name, to: :controller def initialize(controller, item, options) @controller = controller @item = item @options = options end def call respond do if respond_to?("_#{action_name}", true) send("_#{action_name}") else default_action end end end def succeeded? if @options.key?(:success) @options[:success] else Array(@item).all? { |item| item.errors.blank? } end end def respond end def default_action end end end end
Version data entries
3 entries across 3 versions & 1 rubygems