Hi,
I am trying to create a design for user defined tables which could be stored in a database then initialized from a controller as needed. At present I am having a bit of trouble getting these metamodels into the rails env from a controller. Is there a way that I can class_eval a model that would be able to be seen for the duration of that process?
class Admin::UdtManagersController < Admin::Auth #< ApplicationController before_filter :initialize_meta_environment
def index # rails complains if this isn’t here end
private
def initialize_meta_environment
@table = 'review_processes' #define this hard coded for now... later passed via param
@model = @table.classify
init_models
end
def init_models
class_eval= %q{
class #{@model} < ActiveRecord::Base
validates_presence_of :summary_reviews
end
}
## How can I eval this model so it will become part of my application for that process?
end
end
Any help is totally appreciated! Thanks in advance.
-Mark