class UserPlane::RouteConcerns::Base

Defines two resources: A session resource to sign a user in and out A details resource to let a user change the account's details It also defines an extra concern And a signed_in routing concern to ensure that child routes are accessible only to signed in users. It defines a route to edit the account details and one to sign in and sign out.

To enforce being singed in to certain resources: resource :score, concern: :signed_in

scope '/profile' concern: :signed_in do

resource :score
resource :buddies

end

Attributes

singed_in_constraint[RW]

Public Instance Methods

build() click to toggle source
# File lib/user_plane/route_concerns.rb, line 78
def build
  mapper.resource :sign_in, options(only: [:new, :create, :destroy]) do
    if exists? :auth_endpoint
      mapper.concerns :auth_endpoint, controller: :sign_ins
    end
  end

  mapper.resource :details, options(only: [:edit, :update],
                                    as: :update_details,
                                    constraints: RouteConcerns.signed_in_constraint)
end