Sha256: cb280bb755a9929da3cdee3f47b540b7db60aafd2e267851ecfdfaf9bd30a54f

Contents?: true

Size: 1004 Bytes

Versions: 30

Compression:

Stored size: 1004 Bytes

Contents

class Avo::Current < ActiveSupport::CurrentAttributes
  # if Rails.env.development?
  # singleton_class.attr_accessor :previous_attributes
  # before_reset {
  #   puts ["before_reset->", self.previous_attributes].inspect
  #   if attributes.present?
  #     puts ["has attributes->"].inspect
  #     self.previous_attributes = attributes
  #   end
  #   puts ["before_reset->", self.previous_attributes].inspect
  # }

  # attr_accessor :previous_attributes

  # def previous_attributes=(value)
  #   @previous_attributes = value
  # end
  # end

  attribute :app
  attribute :license
  attribute :context, :user, :view_context
  attribute :error_manager
  attribute :resource_manager
  attribute :tool_manager
  attribute :plugin_manager
  attribute :locale

  # Protect from error #<RuntimeError: Missing rack.input> when request is ActionDispatch::Request.empty
  def params
    request.params
  rescue
    {}
  end

  def request
    view_context&.request || ActionDispatch::Request.empty
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
avo-3.4.1 lib/avo/current.rb
avo-3.4.0 lib/avo/current.rb
avo-3.3.6 lib/avo/current.rb
avo-3.3.5 lib/avo/current.rb
avo-3.3.4 lib/avo/current.rb
avo-3.3.3 lib/avo/current.rb
avo-3.3.2 lib/avo/current.rb
avo-3.3.1 lib/avo/current.rb
avo-3.3.0 lib/avo/current.rb
avo-3.2.3 lib/avo/current.rb
avo-3.0.1.beta23 lib/avo/current.rb
avo-3.0.1.beta24 lib/avo/current.rb
avo-3.2.2 lib/avo/current.rb
avo-3.2.1 lib/avo/current.rb
avo-3.2.0 lib/avo/current.rb
avo-3.1.7 lib/avo/current.rb
avo-3.1.6 lib/avo/current.rb
avo-3.1.5 lib/avo/current.rb
avo-3.1.4 lib/avo/current.rb
avo-3.1.3 lib/avo/current.rb