Sha256: 8517cbb823ac8f28bb84dc64600315c3532209ee783ee1f785a000e22e6d7815

Contents?: true

Size: 498 Bytes

Versions: 29

Compression:

Stored size: 498 Bytes

Contents

    identified_by :loco_permissions

    def connect
      # loco_permissions should be the same as in application_controller.rb
      # + SecureRandom.uuid is mandatory at 1st position
      self.loco_permissions = [SecureRandom.uuid, current_user, current_admin]
    end

    protected

      def current_admin
        defined?(Admin) && Admin.find_by(id: cookies.signed[:admin_id])
      end

      def current_user
        defined?(User) && User.find_by(id: cookies.signed[:user_id])
      end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
loco-rails-4.1.1 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-4.1.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-4.0.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.6 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.5 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.4 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.3 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.5.3 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.5.2 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.2 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.1 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.5.1 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.5.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.4.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.3.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-3.0.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.2.2 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.2.1 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.2.0 lib/generators/loco/file_injector/templates/connection.rb
loco-rails-2.1.0 lib/generators/loco/file_injector/templates/connection.rb