问题
I am writing a JRuby rails app that uses mysql-backed models. Now, I need to update the models from OUTSIDE the app (via EventMachine / similar), so that the Controllers etc IN the rails app can get access to the fresh data.
So, is the Rails ORM available inside EventMachine? Will there be catastrophic consequences if I update the mysql tables from inside EventMachine (if the ORM is not available to me)?
回答1:
You could always require 'config/environment.rb'
, that'll give you access to all the models.
来源:https://stackoverflow.com/questions/3056133/access-models-from-outside-rails-app