Instead of hard-coding the scheme and host everywhere, use _path
methods to show relative URLs.
Except that our previous setting of
Rails.application.routes.default_url_options in
config.after_initialize made this moot because Rails inserts that
host into all _path helpers for some reason. So revert that
setting.
But then anything that wants an absolute URL doesn't know the
hostname and the root_url helper throws an exception. So make a
Rails.application.root_url shortcut to pass the per-app settings in
Rails.application to root_url.
Now we can just use _path helpers most places but still use _url
ones where we need them, such as in RSS views and e-mail templates.
4-byte utf8 chars like emoji are passed around in ruby fine, but
when they are put into mysql queries, strings get truncated at the
first mb4 character. to prevent truncation, strip out mb4
characters in most user-controlled fields like comments, story
descriptions and titles, and messages.
to properly support utf8mb4, mysql server 5.5 is needed, the table
encodings need to be changed to utf8mb4, and the mysql2 gem needs to
be upgraded once it supports utf8mb4:
https://github.com/brianmario/mysql2/issues/249