Marten::Handlers::RecordDetail
Inherits Marten::Handlers::RecordRetrieving / Marten::Handlers::Template / Marten::Handlers::Rendering / Marten::Handlers::Base / Marten::Handlers::XFrameOptions / Marten::Handlers::ContentSecurityPolicy / Marten::Handlers::Session / Marten::Handlers::RequestForgeryProtection / Marten::Handlers::Flash / Marten::Handlers::Cookies / Marten::Handlers::ExceptionHandling / Marten::Handlers::Callbacks / Marten::Core::DebugModeLoggable / Reference / Object
Handler allowing to display a specific model record.
This handler can be used to showcase a specific model record. It is expected that the handler will be accessed through a GET request only: as part of this request, the configured template is rendered and displayed (and the retrieved model record is inserted into the template context)
class MyRecordHandler < Marten::Handlers::RecordDetail
model MyModel
template_name "my_record.html"
end
The model class used to retrieve the record can be configured through the use of the #model macro. The
#template_name class method allows to define the name of the template to use to render the model record.
Class methods
Returns the name of the model field that will be used to retrieve the record (defaults to pk).
Allows to configure the name to use to include the model record into the template context.
Returns the name to use to include the model record into the template context (defaults to record).