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 DeviseHelper | |
def devise_error_messages! | |
return '' if resource.errors.empty? | |
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg, class: 'p-toast') }.join | |
html = <<-HTML | |
<ul class="hide">#{messages}</ul> | |
HTML | |
html.html_safe | |
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
- unless resource.errors.empty? | |
= devise_error_messages! | |
#member-members-registrations-edit | |
.row | |
.col.s12.m9 | |
.section | |
#p-title.col.s12.scrollspy | |
h2.u-title Edit Profile |
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-members-sessions-new | |
.row | |
.col.s12.m9 | |
.section | |
#p-title.col.s12.scrollspy | |
h2.u-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
module ApplicationHelper | |
def nav_header(key) | |
active = false | |
if key == :profile | |
active = true if is_nav_active?(:edit_profile) | |
active = true if is_nav_active?(:sign_out) | |
text = 'Profile' | |
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' |
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 Admin < ActiveRecord::Base | |
devise :database_authenticatable, :trackable, :timeoutable | |
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
class DeviseCreateAdmins < ActiveRecord::Migration | |
def change | |
create_table(:admins) do |t| | |
# Database authenticatable | |
t.string :email, null: false, default: "" | |
t.string :encrypted_password, null: false, default: "" | |
# Trackable | |
t.integer :sign_in_count, default: 0, null: false |
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
Rails.application.routes.draw do | |
devise_for :members, path: 'member/members' | |
devise_for :admins, path: 'admin/admins' | |
resources :members, path: 'admin/members' | |
mount API => '/api/' | |
get 'welcome/index' | |
root to: 'welcome#index' | |
match '*path' => 'application#error404', via: :all | |
end |