Code Snippet
Attribute partials are used to display a single attribute of a model, within an `index` table colum or the resource's `show` screen.
Read more about them and about the form field partials in the extensive developer documentation.
Samples
CSS example
0.9ms
577 allocs
h1 {
font-size: 3em;
color: red;
text-transform: uppercase;
font-family: Futura, sans-serif;
margin-bottom: 3em;
line-height: 1;
max-inline-size: 50ch;
text-wrap: balance;
}
View Source
<%
object.text_area_value = <<~CSS
h1 {
font-size: 3em;
color: red;
text-transform: uppercase;
font-family: Futura, sans-serif;
margin-bottom: 3em;
line-height: 1;
max-inline-size: 50ch;
text-wrap: balance;
}
CSS
%>
<%= render 'shared/attributes/code_snippet', object: object, strategy: :label, attribute: :text_area_value %>
Options
Name | Required | Type | Default | Description |
---|---|---|---|---|
object |
Object |
Reference to the model object |
||
attribute |
String |
Attribute of the model |