A Rails helper gem for quickly displaying model attributes and associations with I18n support and customizable HTML output.
ShowFor is a Ruby on Rails gem that provides a helper for quickly displaying model attributes and associations in views. It generates structured HTML with labels and values, supports internationalization, and offers extensive customization options for rendering. It solves the problem of repetitive and verbose view code when showing model data.
Rails developers building admin panels, data display interfaces, or any view that needs to consistently present model information with minimal boilerplate code.
Developers choose ShowFor for its clean DSL, I18n integration, and flexibility—it reduces view complexity while allowing deep customization of HTML output and value rendering logic.
Wrap your objects with a helper to easily show them
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically uses human_attribute_name for labels and I18n.localize for date formatting, reducing boilerplate for multilingual apps as shown in the examples.
Supports multiple value sources including blocks, the :value option, human_* methods, and direct attribute access, detailed in the 'Value lookup' section for customization.
Can render has_one, belongs_to, and collection associations with options like :using for methods or :to_sentence for inline display, simplifying complex data relationships.
Allows control over container tags, HTML attributes, and separators through options like :wrapper_html and :label_tag, enabling fine-tuned styling per the README.
Only works within Ruby on Rails applications, making it unsuitable for projects using other frameworks or languages, which limits its adoption scope.
The README notes that this branch is for Rails 7 and 8, with older versions requiring different branches, leading to fragmentation and potential upgrade headaches.
Generates HTML on the server, so it's not ideal for applications needing real-time updates or complex client-side interactions without additional JavaScript workarounds.