This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Devise.setup do |config| | |
require 'devise/orm/active_record' | |
config.mailer_sender = '[email protected]' | |
config.case_insensitive_keys = [:email] | |
config.strip_whitespace_keys = [:email] | |
config.skip_session_storage = [:http_auth] | |
config.stretches = Rails.env.test? ? 1 : 10 | |
config.reconfirmable = true | |
config.expire_all_remember_me_on_sign_out = true | |
config.password_length = 8..72 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#admins-sessions-new | |
.row | |
.col.s12.m9 | |
.section | |
#p-title.col.s12.scrollspy | |
h2.p-title Sign in | |
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| | |
.input-field.col.s12.l9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MembersController < ApplicationController | |
before_filter :authenticate_admin! | |
before_action :set_member, only: [:show, :edit, :update, :destroy] | |
# GET /members | |
# GET /members.json | |
def index | |
@members = Member.page(params[:page]).order('created_at DESC') | |
@page = params[:page] || 1 | |
respond_to do |format| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def admin_page? | |
return true if /\A \/ admin \/ /xm === request.fullpath | |
return false | |
end | |
def member_page? | |
return true if /\A \/ member \/ /xm === request.fullpath | |
return false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member.create! email: '[email protected]', password: 'hogehoge' | |
Admin.create! email: '[email protected]', password: 'hogehoge' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def after_sign_in_path_for(resource) | |
return members_path if resource.class.name == 'Admin' | |
return edit_member_registration_path if resource.class.name == 'Member' | |
root_path | |
end | |
def after_sign_out_path_for(resource) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#admin-members-show | |
.row | |
.col.s12.m9 | |
.section | |
#p-title.col.s12.scrollspy | |
h2.u-title Member Info | |
.col.s12 | |
table.striped.responsive-table | |
tr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#members-index | |
.row | |
.col.s12.m9 | |
.section | |
#p-title.col.s12.scrollspy | |
h2.p-title members | |
.col.s12 | |
table.striped.responsive-table | |
thead |