Skip to content

Instantly share code, notes, and snippets.

View yamaaki's full-sized avatar

Yamaya Akihiro yamaaki

  • Tokyo, Japan
View GitHub Profile
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
if Rails.env.production?
rescue_from Exception, with: :error500
rescue_from ActiveRecord::RecordNotFound, ActionController::RoutingError, with: :error404
end
def error404
render 'error404', status: 404, formats: [:html]
.row
.col.s12.m6.offset-m3
.section
.section
.section
.card-panel.red.darken-1.center-align.white-text
.section
i.material-icons.medium error
h6 Page Not Found.
.row
.col.s12.m6.offset-m3
.section
.section
.section
.card-panel.red.darken-1.center-align.white-text
.section
i.material-icons.medium error
h6 Out of Service.
Rails.application.routes.draw do
mount API => '/api/'
get 'welcome/index'
root to: 'welcome#index'
match '*path' => 'application#error404', via: :all
end
Rails.application.configure do
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
config.active_record.migration_error = :page_load
config.assets.debug = true
config.assets.digest = true
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true
config.log_level = :debug
class Member < ActiveRecord::Base
devise :database_authenticatable, :registerable, :rememberable, :trackable, :validatable
end
class DeviseCreateMembers < ActiveRecord::Migration
def change
create_table(:members) do |t|
# Database authenticatable
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
# Rememberable
t.datetime :remember_created_at
@yamaaki
yamaaki / routes.rb
Last active September 21, 2015 16:51
Rails.application.routes.draw do
mount API => '/api/'
get 'welcome/index'
root to: 'welcome#index'
devise_for :members, path: :member, controllers: {
registrations: 'member/members/registrations',
sessions: 'member/members/sessions',
}
namespace :member do
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