Sha256: f5048c37a159bdd832cfbaa662191f59fc4c48033c6ec394c07cb7336513f125
Contents?: true
Size: 1.79 KB
Versions: 57
Compression:
Stored size: 1.79 KB
Contents
= CMOR User Area = Migration to 4.0.0 Defining after_sign_in_url in the controller is not supported anymore. Control the after sign in location by configuring it in the initializer: # config/initalizers/cmor_user_area.rb Cmor::UserArea.configure do |config| config.after_sign_in_url = ->(controller) { last_location || main_app.root_path } end = Installation Add it to your Gemfile: # Gemfile gem 'cmor_user_area2' Install: rails g cmor:user_area:install Add Migrations and migrate: rake cmor_user_area:install:migrations && rake db:migrate Optionally, create a default user (user@example.com/password): rake cmor:user_area:create_default_user Add routes: # config/routes.rb mount Cmor::UserArea::Engine, at: '/auth' Add current_user helpers to your application controller: # app/controllers/application_controller.rb include Cmor::UserArea::Controller::RedirectBackConcern include Cmor::UserArea::Controller::CurrentUserConcern = Usage to secure a controller, add following before_action: # app/controllers/my_secure_controller.rb before_action :authenticate_user! When you visit any controller actions, you will be redirected to the sign in form. = Adding helper methods # app/controllers/application_controller.rb include Cmor::UserArea::Controller::CurrentUserConcern This gives you #current_user_session, #current_user, user_signed_in? = Using the navigation helper # app/controllers/application_controller.rb view_helper Cmor::UserArea::ApplicationViewHelper, as: :user_area_helper # app/views/layouts/application.html.erb <%= user_area_helper(self).render_navigation %> = Running Specs gem install bundler bundle cd spec/dummy && rake db:migrate RAILS_ENV=test && cd ../.. guard This project rocks and uses MIT-LICENSE.
Version data entries
57 entries across 57 versions & 1 rubygems