crumble-orma
Version, currently 0.1.07 versions
github.com/sbsoftware/crumble-orma
Integration shard for `crumble` and `orma`
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
crumble-orma:
github: sbsoftware/crumble-orma
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
crumble-orma
Small integration helpers between Crumble and Orma.
Installation
-
Add the dependency to your
shard.yml:dependencies: crumble-orma: github: sbsoftware/crumble-orma -
Run
shards install
Usage
require "crumble-orma"
Page model loading
class User < Orma::Record
column name : String
end
class UserPage < Crumble::Page
model user : User
template do
p { user.name }
end
end
The model macro defines a user_id path param, loads the record before handling the
request, exposes user directly in the page template, and returns 404 when the record
is missing. With crumble >= 0.31.0, prefer defining the page markup directly with
template do.
You can provide a redirect or a fallback view when the record is missing:
class UserPage < Crumble::Page
model user : User, fallback_redirect: "/"
template do
p { user.name }
end
end
class MissingUserView
include Crumble::ContextView
template do
p { "User not found" }
end
end
class UserFallbackViewPage < Crumble::Page
model user : User, fallback_view: MissingUserView
template do
p { user.name }
end
end
Orma attributes in HTML + CSS
class Model < Orma::Record
column active : Bool
end
class View
getter model : Model
def initialize(@model); end
ToHtml.instance_template do
div model.active do
model.active ? "Active" : "Inactive"
end
end
end
class Style < CSS::Stylesheet
rule Model.active(false) do
color "#8a8a8a"
end
end
Rendering adds a data-orma-... attribute to the element, and the attribute can be
used in CSS selectors via Model.active(false).
Development
- Install dependencies:
shards install - Run tests:
crystal spec - Format code before PRs:
crystal tool format
Contributing
- Fork it (https://github.com/sbsoftware/crumble-orma/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Stefan Bilharz - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Mar 24, 2026
- Commit
d0337bbfb6e9- Indexed
- not yet
Dependents
Repository
github.com/sbsoftware/crumble-orma
Metadata
- Created
- Aug 19, 2026
- Updated
- Sep 22, 2026
- Synced
- Sep 22, 2026
- Versions
- 7