AutoCode load from database? AutoCode Performance?

9 просмотров
Перейти к первому непрочитанному сообщению

Julie

не прочитано,
22 мар. 2010 г., 00:53:1622.03.2010
– rubywaves
Hi,

I just checkout the code at http://github.com/waves/autocode. It is
really well done.
I have two questions
1. Is there performance issue for using AutoCode? AutoLoad?
2. If I want to use AutoCode to load model from database? which part
of the code that I need to change?

Thanks,
julie

Jerry

не прочитано,
9 мая 2010 г., 16:46:4009.05.2010
– rubywaves
Julie,

yes, there is always a trade-off between convenience and performance;
having said that, the overhead is not great.

I'm not sure what you mean by "load model from database"; do you mean
the Ruby code describing the model is stored in a database or that you
want to load instances of a model (records) from a database?

If the Ruby code is in a database you need to change the definition of
auto_load in autocode/lib/autocode.rb. Instead of Kernel.load(path)
you will need to read in the model definition code from your database
and "eval" that in the correct context to have it defined.

If (more likely?) you mean to autoload instances of a model, that's
not the point of autoload. Autoload will load in the classes that
define your model, so you can simply say (for instance) "User.first"
and the correct definition of User will be found, loaded and executed.

Does that help?

Jerry

--
You received this message because you are subscribed to the Google Groups "rubywaves" group.
To post to this group, send email to ruby...@googlegroups.com.
To unsubscribe from this group, send email to rubywaves+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubywaves?hl=en.

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений