Imagine a web application written in Ruby on Rails. Part of the state of this application is presented as a part of the data that does not match the description of the model. This state descriptor must be stored in the same database as the models. Where it differs from the model, there should be only one instance of its class, and it has no relationship with other classes.
Has anyone come across something like this?
From your description, I think the rails-settings plugin should do what you need.
From the Readme:
" - , . , , ActiveRecord . , rails, . , , .
http://github.com/Squeegy/rails-settings/tree/master
, , .
RoR; OO.
, , , , factory .
. Logger ( singleton), / .
Rails, . "", - ActiveRecord Rails.
, . ( ) :
class ApplicationController < ActionController::Base helper :all @data = "YOUR DATA HERE" end
, Rails.
, , , Rails.
, Ruby : -)
, , , , "data":
ComplexThing.data = complex_hash.inspect
,
complex_hash = eval ComplexThing.data
: