Skip to content

Instantly share code, notes, and snippets.

View youclavier's full-sized avatar
🏠
Working from home

JamesYou youclavier

🏠
Working from home
  • Shenzhen, HongKong, China
View GitHub Profile
@youclavier
youclavier / yield.rb
Created August 12, 2014 05:57 — forked from cowboy/yield.rb
# No yielding
class NormPerson
attr_accessor :first, :last
def initialize(first = nil, last = nil)
@first = first
@last = last
end
def hello
puts "#{@first} #{@last} says hello!"
class ApplicationController < ActionController::Base
# ...
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: lambda { |exception| render_error 500, exception }
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception }
end
private
def render_error(status, exception)