Ok, some further research has ruled out the caching theory.
If I do something like this...
body = lambda do
set_table_name class_name
belongs_to :user
belongs_to :another_association
end
Object.const_set class_id, Class.new(ActiveRecord::Base,
&body)
p class_id.to_s.constantize.reflections
produces reflections as {} already!
The dynamic class works fine for accessing the associations
like
obj.user and such, but because the reflections hash is empty
I can't
use things like :include => :user with it.
Any core members or hard core rail-ites with any idea as to
what I'm
doing wrong?
Thanks,
Andrew
On 10/3/06, Andrew Kaspick <akaspick gmail.com> wrote:
> Hello,
>
> I have a question regarding some ActiveRecord based
models that I
> dynamically create in my app.
>
> For my file based models, when I look at the
reflections hash,
> everything looks good.
> eg.) SomeModel.reflections produces all of the
reflections associated
> with the model.
>
> Now with my non-file based models (ones created
dynamically in
> memory), the reflections hash is empty. Methods for
associations are
> created correctly though.
> eg.) DynamicModel.reflections produces {}
>
> What would be going on behind the scenes that I'm may
not be fully
> aware of that would be cuasing this issue? My thoughts
are leading me
> to think it's some sort of cacheing issue, but I'm not
100% sure.
>
> Thanks in advance,
> Andrew
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe googlegroups.com
For more options, visit this group at http:
//groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---
|