Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions app/controllers/well_knowns_controller.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# frozen_string_literal: true

class WellKnownsController < ApplicationController
before_action :set_well_known

attr_reader :well_known

class WellKnownsController < ActionController::API
def show
if well_known.present?
render renderable: @well_known
well_known = WellKnown.find_by(name: params[:name])

case well_known&.format
when :text
render plain: well_known.content
when :json
render json: well_known.content
else
head :not_found
end
end

private

def set_well_known
@well_known = WellKnown.find_by(name: params[:name])
end
end
4 changes: 0 additions & 4 deletions app/models/well_known.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ class WellKnown < ApplicationRecord
where(arel_table[:name].matches("%#{query}%"))
end

def render_in(view_context)
view_context.render(plain: content)
end

def format
content_type.to_sym
end
Expand Down