class ActiveResponse::Responders::HTML
Public Instance Methods
collection(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 8 def collection(**opts) controller.render opts end
destroyed(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 12 def destroyed(**opts) opts[:status] = 303 controller.respond_with_redirect(opts) end
form(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 17 def form(**opts) controller.render opts[:view], opts.except(:view) end
invalid_resource(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 21 def invalid_resource(**opts) if controller.action_name == 'destroy' controller.respond_with_redirect(location: opts[:resource]) else controller.respond_with_form(controller.default_form_options(form_for_invalid(opts))) end end
new_resource(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 29 def new_resource(**opts) controller.respond_with_redirect(opts) end
redirect(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 33 def redirect(**opts) controller.send(:redirect_to, opts[:location], opts.except(:location)) end
resource(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 37 def resource(**opts) controller.render :show, opts end
updated_resource(**opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 41 def updated_resource(**opts) controller.respond_with_redirect(opts) end
Private Instance Methods
form_for_invalid(opts)
click to toggle source
# File lib/active_response/responders/html.rb, line 47 def form_for_invalid(opts) return opts[:form] if opts[:form].present? return 'new' if controller.action_name == 'create' 'edit' end