Run:
dpkg-reconfigure tzdataChoose your city.
module CarrierWave class SanitizedFile attr_accessor :file class << self attr_writer :sanitize_regexp def sanitize_regexp @sanitize_regexp ||= /[^a-zA-Z0-9\.\-\+_]/ end end ...Redefine value of this attribute:
CarrierWave::SanitizedFile.sanitize_regexp = /[^a-zA-Zа-яА-ЯёЁ0-9\.\_\-\+\s\:]/(thanks koHkB|/|cTadop)
irb> URI.decode( "%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B0.jpg") => "картинка.jpg"
irb> ["one","two","three"].to_sentence => "one, two and three"you can use different options to humanize output:
irb> ["one","two","three"].to_sentence(words_connector: " not equal ") => "one not equal two and three"
irb> ["to be", "not to be"].to_sentence(two_words_connector: " or ") => "to be or not to be"But remember about your default locale in Rails!
# application.rb config.i18n.default_locale = :ru irb> ["one","two","three"].to_sentence => "one, two и three"To read:
class ApplicationController < ActionController::Base ... before_filter :check format ... def check_format unless (Mime::EXTENSION_LOOKUP.values << Mime::ALL).include?(request.format) render file: 'public/404.html', layout: false, status: 406 end end ... endMime::EXTENSION_LOOKUP returns hash of all mime types registred in your app. In my case:
irb> Mime::EXTENSION_LOOKUP
{"html"=>text/html, "xhtml"=>text/html, "text"=>text/plain, "txt"=>text/plain, "js"=>text/javascript, "css"=>text/css, "ics"=>text/calendar, "csv"=>text/csv, "png"=>image/png, "jpeg"=>image/jpeg, "jpg"=>image/jpeg, "jpe"=>image/jpeg, "gif"=>image/gif, "bmp"=>image/bmp, "tiff"=>image/tiff, "tif"=>image/tiff, "mpeg"=>video/mpeg, "mpg"=>video/mpeg, "mpe"=>video/mpeg, "xml"=>application/xml, "rss"=>application/rss+xml, "atom"=>application/atom+xml, "yaml"=>application/x-yaml, "multipart_form"=>multipart/form-data, "url_encoded_form"=>application/x-www-form-urlencoded, "json"=>application/json, "pdf"=>application/pdf, "zip"=>application/zip, "xlsx"=>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, "printable"=>text/html}
last two - my mime types from config/initializers/mime_types.rb initializerMime::EXTENSION_LOOKUP.values << Mime::ALLbut it's a good practise to use right headers in your requests.
$.ajaxSetup
beforeSend: (xhr) ->
xhr.setRequestHeader("Accept", "application/json")
beforeSend: (xhr) ->
xhr.setRequestHeader("Accept", "text/html")
pkill -f programnamefor example pkill -f rails kill all processes whose names contains "rails": rails server, rails console, etc.