crumble-orma
Version, currently 0.6.07 versions
github.com/sbsoftware/crumble-orma
Integration shard for `crumble` and `orma`
Installation
# Add this to your shard.yml
dependencies:
crumble-orma:
github: sbsoftware/crumble-orma
version: ~> 0.6.0Then run:
shards installshard.yml
- Crystal
>= 1.16.3- License
- MIT
- Author
- Stefan Bilharz
Dependencies
Runtime Dependencies
Development Dependencies
- sqlite3*github: crystal-lang/crystal-sqlite3dev
README
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.6.0- Tagged
- Sep 2, 2026
- Commit
f7a9bfba3c9b- Crystal
>= 1.16.3- Indexed
- yes
Dependents
Repository
github.com/sbsoftware/crumble-orma
Metadata
- Created
- Aug 19, 2026
- Updated
- Sep 22, 2026
- Synced
- Sep 22, 2026
- Versions
- 7