Mike Laurence
2008-Feb-11 06:15 UTC
Should there be trouble w/has_many_polymorphs in a plugin?
Folks, As much as I like generators, I''d greatly prefer to just throw my has_many_polymorphs tagging and commenting engines into projects as plugins. However, after transplanting my tag.rb and tagging.rb files into the lib folder of a ''has_many_tags'' plugin and adding the obligatory plugin requirements (init.rb and an include in environment.rb), I''m not having any luck. All I get is a white screen courtesy of a call to .tag_list (incidentally - anyone know how to get view exceptions to actually show up instead of just a white screen?) Due to said white screen and lack of exception data (in logs or anywhere), I''ve hit a bit of a road block. Does anyone have any suggestions, or know if there''s some kind of hackery required to make has_many_polymorphs and plugins happy together? Thanks, Mike -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mike Laurence
2008-Feb-11 20:07 UTC
Re: Should there be trouble w/has_many_polymorphs in a plugi
Note - even a ''yes, I''ve successfully used has_many_polymorphs in a plugin and/or engine'' would be beneficial. A little confirmation might just boost me back into hardcore troubleshooting mode... :-) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Feb-11 20:26 UTC
Re: Should there be trouble w/has_many_polymorphs in a plugi
On 11 Feb 2008, at 20:07, Mike Laurence wrote:> > Note - even a ''yes, I''ve successfully used has_many_polymorphs in a > plugin and/or engine'' would be beneficial. A little confirmation might > just boost me back into hardcore troubleshooting mode... :-)I know nothing about has_many_polymorphs, but here''s a random guess: remove your plugin from Dependencies.load_once_paths (I usually do this in the init.rb of the plugin). Otherwise really weird stuff can happen, because your plugin isn''t reloaded, but models it references are reloaded. Fred> > -- > Posted via http://www.ruby-forum.com/. > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > -~----------~----~----~----~------~----~------~--~--- >
Mike Laurence
2008-Feb-13 04:44 UTC
Re: Should there be trouble w/has_many_polymorphs in a plugi
Frederick Cheung wrote:> On 11 Feb 2008, at 20:07, Mike Laurence wrote: > >> >> Note - even a ''yes, I''ve successfully used has_many_polymorphs in a >> plugin and/or engine'' would be beneficial. A little confirmation might >> just boost me back into hardcore troubleshooting mode... :-) > > I know nothing about has_many_polymorphs, but here''s a random guess: > remove your plugin from Dependencies.load_once_paths (I usually do > this in the init.rb of the plugin). > Otherwise really weird stuff can happen, because your plugin isn''t > reloaded, but models it references are reloaded. > > FredHmmm... tried removing either & both plugins (has_many_polymorphs and my plugin) out of the load_once_paths, but it didn''t fix the issue. ''respond_to'' shows that the tagging methods are in fact present in my plugin models, but something''s going wrong in the internals. Guess I''ll try and dig deeper. Load_once_path should help with the debugging process quite a bit, though - didn''t know about that one, so thank you for the tip! FYI to any folks who need to remove anything from load_once_path - if ''Dependencies.load_once_paths.delete xxxx'' is giving you trouble (I couldn''t get my paths to match dynamically due to issues with RAILS_ROOT), use: Dependencies.load_once_paths.delete_if { |e| e.match(/plugin_regex/) } etc. That way you''re guaranteed it will delete properly. Mike -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---