Skip to content

Instantly share code, notes, and snippets.

View AlekseyPn's full-sized avatar
👨‍💻
Not time to rest

_fargustian AlekseyPn

👨‍💻
Not time to rest
  • Berlin
View GitHub Profile
@AlekseyPn
AlekseyPn / application_controller.rb
Created September 15, 2018 16:03 — forked from AhmedNadar/application_controller.rb
How to redirect to a 404 in Rails?
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
def not_found
raise ActionController::RoutingError.new('Not Found')
rescue
render_404
end
@AlekseyPn
AlekseyPn / customize_error.rb
Created May 22, 2018 17:19 — forked from telwell/customize_error.rb
Customize Field Errors with Rails 5 and Bootstrap
# Adapted from https://rubyplus.com/articles/3401-Customize-Field-Error-in-Rails-5
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
html = ''
form_fields = [
'textarea',
'input',
'select'
]