Extract render svg as a real renderer
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
class Accounts::JoinCodesController < ApplicationController
|
||||
def show
|
||||
render_svg RQRCode::QRCode.new(join_url(Current.account.join_code)).as_svg(viewbox: true, fill: :white, color: :black)
|
||||
render svg: RQRCode::QRCode.new(join_url(Current.account.join_code)).as_svg(viewbox: true, fill: :white, color: :black)
|
||||
end
|
||||
|
||||
def update
|
||||
Current.account.reset_join_code
|
||||
redirect_to account_users_path
|
||||
end
|
||||
|
||||
private
|
||||
# FIXME: Upstream to Rails as render svg:
|
||||
def render_svg(svg)
|
||||
render content_type: Mime[:svg], body: svg
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# FIXME: Upstream to Rails
|
||||
Rails.application.config.after_initialize do
|
||||
ActionController.add_renderer :svg do |svg, options|
|
||||
self.content_type = Mime[:svg] if media_type.nil?
|
||||
svg
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user