Sha256: 7801d32bb9f3fdf1a8df2a6473b5ab871f11eeda493eb060497a87468e9f86cf

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

class BaseClass
  # Do NOT use a controller inherited base class to add concerns!
  # If you do that, you'd be sharing state (i.e. overriding/adding) from  concerns across controllers
  # which will probably lead to sharing issues you didn't expect.
  # For example: any controller adding after/before/around filters will be visible
  # to any other controllers sharing the concern.
  # Include a concern to all of them instead

  # Inheritance of classes should be independent from the concerns.
  # I.e., you can use class inheritance in cases where it makes sense from an OO point of view
  # but for the most part, you can probably share code through modules/concerns too.
  def this_is_shared; end

  # Just a dummy method to use as if it was an Authenticated concern for the current request...
  def self.current_user_privs
    ['special#read']
  end

  def display_attribute?(privs)
    # Do not expand, unless the current user has all the required privileges
    return nil unless (self.class.current_user_privs & privs) == privs

    true
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
praxis-2.0.0 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.40 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.39 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.38 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.37 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.36 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.35 spec/spec_app/app/controllers/base_class.rb
praxis-2.0.pre.34 spec/spec_app/app/controllers/base_class.rb