Come usare una forma su Redis e Ohm e senza ACTIITECORD?
-
15-11-2019 - |
Domanda
Sto usando Redis come database e Ohm come sostituzione di ActiveRecord.
Quando creo un modulo per la creazione di un oggetto, posso utilizzare il Viewhelper Form_for per creare facilmente moduli per modificare e creare oggetti.
C'è qualcosa del genere per Ohm?
Cordiali saluti, hijolan
Soluzione
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.
Altri suggerimenti
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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow