How to use a form on Redis and Ohm and without ActiveRecord?
-
15-11-2019 - |
Question
I am using redis as database and ohm as ActiveRecord replacement.
When I create a form for creating an object I may use the form_for viewhelper to easyly create forms to edit and create objects.
Is there something like that for ohm?
Best regards, hijolan
Solution
class MyShinyModel < Ohm::Model
include ActiveModel::SomeModule
# ...
end
And proceed like desribed here http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/ or here http://asciicasts.com/episodes/219-active-model.
OTHER TIPS
There should be no correlation between the ORM you are using and the ActionView form helpers. As long as OHM is an implementation of the ActiveModel API, it should just work as expected.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow