كيفية استخدام نموذج على Redis وأوم وبدون activerecord؟
-
15-11-2019 - |
سؤال
أنا أستخدم Redis كقاعدة بيانات وأوم كما استبدال activerecord.
عندما أقوم بإنشاء نموذج لإنشاء كائن قد استخدم Form_for ViewHelper لإنشاء نماذج سلبيا لتحرير وكائنات.
هل هناك شيء من هذا القبيل لأوم؟
مع أطيب التحيات، hijolan
المحلول
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.
نصائح أخرى
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.
لا تنتمي إلى StackOverflow