arreglos varios

This commit is contained in:
f 2020-08-07 11:15:06 -03:00
parent 65ceba8e6f
commit a0660a473b
4 changed files with 6 additions and 2 deletions

View file

@ -13,6 +13,6 @@ class MetadataImage < MetadataFile
# Determina si es una imagen
def image?
FileMagic.new(FileMagic::MAGIC_MIME).file(file).starts_with? 'image/'
filemagic.file(file).starts_with? 'image/'
end
end

View file

@ -98,7 +98,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
# Eliminar metadatos internos
def anon_post_params
params.permit(post.params).delete_if do |k, _|
%w[date slug order uuid].include? k
%w[date slug order uuid].include? k.to_s
end
end

View file

@ -2,6 +2,8 @@
# compatible con Bootstrap4. La forma actual rompe los inputs
# personalizados.
ActionView::Base.field_error_proc = proc do |html_tag, _|
return unless html_tag
html = Nokogiri::HTML::DocumentFragment.parse html_tag
html.children.first.attributes['class'].value += ' is-invalid'

View file

@ -2,6 +2,8 @@ class ChangeRefererToOrigin < ActiveRecord::Migration[6.0]
def change
rename_column :access_logs, :http_referer, :http_origin
return unless Rails.env.production?
# Eliminar todos los referers anteriores manteniendo el origin
ActiveRecord::Base.connection.execute("update access_logs set http_origin = split_part(http_origin, '/', 1) || '//' || split_part(http_origin, '/', 3) where http_origin is not null")
end