Hi all. I’ve been using Radiant for about 3 months now. Today I noticed
that when editing/creating pages in Radiant, my behavior select field is
empty.
Running:
Behavior.find_all.map { |s| s.registered_id }
From the console returns all my Behaviors, and my actual Ruby files are
there, they’re just not being seen when creating/editing pages.
What’s really bizarre is that the production version of this same web
site behaves as it should. I checked out a fresh copy from subversion,
dropped and migrated my database back and I’m having the same problems.
Oh, my co-worker just informed me that the filters are also missing. I
put a little debug line inside registerable.rb (a scary file imo), and
when starting console I now see…
BASE >>> TextFilter (Module)
BASE >>> Behavior (Module)
Yeah. I’m at a total loss. We haven’t edited anything with Radiant in a
couple weeks, which also means I don’t know how long the problem has
been going on. =(
I haven’t come across your specific issue, but knowing the radiant and
rails codebases, I’m making a guess as to a possible cause.
Your knowledge exceeds mine.
Also, the mental branch doesn’t have behaviours, it has extensions, so
the answer to ‘Do your behaviors load correctly under Mental and Rails
1.2.1?’ is no, but my extensions do. Have a look through the mailing
list archive for more information about porting behaviours to extensions
if you want to go down that path.
I see. When you say 1.2 doesn’t reload, what do you mean? Why does not reloading make Radiant work, but reloading breaks it?
During initialization, the Behaviour class is loaded and all the
subclasses also get loaded. When a subclass is loaded, it registers
itself with the parent class.
What I think is happening is that the Behaviour class is getting
reloaded (and thus clearing the references to the subclasses), but the
subclasses are not reloaded, and thus don’t register themselves.
Either way, thanks for answering, I feel better knowing
someone else has
come across this issue.
I haven’t come across your specific issue, but knowing the radiant and
rails codebases, I’m making a guess as to a possible cause.
If it’s not working after switching to production and your production.rb
has cache_classes set to true, then I don’t think I know what your issue
is.
Also, the mental branch doesn’t have behaviours, it has extensions, so
the answer to ‘Do your behaviors load correctly under Mental and Rails
1.2.1?’ is no, but my extensions do. Have a look through the mailing
list archive for more information about porting behaviours to extensions
if you want to go down that path.
Just had a thought. If your problem is due to reloading, you might want
to add specific ‘require’ statements for behaviour.rb and all your
behaviours into your environment.rb. That should prevent reloading.
I’m still not sure why we want to prevent reloading, but sure enough,
adding require ‘behavior’ in environment.rb fixes it.
Just had a thought. If your problem is due to reloading, you might want
to add specific ‘require’ statements for behaviour.rb and all your
behaviours into your environment.rb. That should prevent reloading.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.