You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my application (Rails 4), the User model is not stored in the 'local' database but is on a backoffice application.
So, I use a tableless model and I have a module 'ApiUser' to access my backoffice.
The User model (tableless) use this module for every operation (read or write data...) on the backoffice.
Of course, I need every ActiveRecord methods, like new, save, update, destroy, all, find....
I'm not sure it's the good way, but in my model I implement a 'all' method (and a corresponding function in the API to retrieve data from the backoffice).
For the moment, in the model, I create an array populated with data by doing something like :
It seems to work, but I have relation (has_many) to other models and some automatic functions don't work (each, index_by, map...) on the relation.
My question : is reimplementig each ActiveRecord method is the good way to do and how to simulate an ActiveRecord::Relation like a real ActiveRecord model ?
If you need more informations on my model, let me know.
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
In my application (Rails 4), the User model is not stored in the 'local' database but is on a backoffice application.
So, I use a tableless model and I have a module 'ApiUser' to access my backoffice.
The User model (tableless) use this module for every operation (read or write data...) on the backoffice.
Of course, I need every ActiveRecord methods, like
new
,save
,update
,destroy
,all
,find
....I'm not sure it's the good way, but in my model I implement a 'all' method (and a corresponding function in the API to retrieve data from the backoffice).
For the moment, in the model, I create an array populated with data by doing something like :
It seems to work, but I have relation (has_many) to other models and some automatic functions don't work (each, index_by, map...) on the relation.
My question : is reimplementig each ActiveRecord method is the good way to do and how to simulate an ActiveRecord::Relation like a real ActiveRecord model ?
If you need more informations on my model, let me know.
Thanks
The text was updated successfully, but these errors were encountered: