Nathaniel S. H. Brown
2006-Feb-10 14:08 UTC
[3795] render_component doesn''t work with modules?
I just submitted a bug report for the render_component not being able to properly find the modules. I did a pretty detailed search, and wasn''t able to find anything in the tracker. Is this something you guys are already aware of ? http://dev.rubyonrails.org/ticket/3795 -Nb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nathaniel S. H. Brown
2006-Feb-10 14:35 UTC
RE: [3795] render_component doesn''t work with modules?
Just nailed it down to having a "/" in the controller. If you even trying: render_component :controller => "/blog", :action => "list" It will produce an error saying it cant find ::Blog -Nb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> -----Original Message----- > From: rails-core-bounces@lists.rubyonrails.org > [mailto:rails-core-bounces@lists.rubyonrails.org] On Behalf > Of Nathaniel S. H. Brown > Sent: February 10, 2006 6:09 AM > To: rails-core@lists.rubyonrails.org > Subject: [Rails-core] [3795] render_component doesn''t work > with modules? > > I just submitted a bug report for the render_component not > being able to properly find the modules. > > I did a pretty detailed search, and wasn''t able to find > anything in the tracker. Is this something you guys are > already aware of ? > > http://dev.rubyonrails.org/ticket/3795 > > -Nb > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Nathaniel S. H. Brown http://nshb.net > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >
Trevor Squires
2006-Feb-10 15:23 UTC
Re: [3795] render_component doesn''t work with modules?
Hi Nathaniel, I''m using a version of edge (not the most recent, but after module namespace support was improved) and I use render_component into a module namespace quite extensively with no problems. I know you said you "nailed it down to having a ''/'' in the controller" but are you sure it''s not simply the *leading* slash character that''s giving you problems? Regards, Trevor On 10-Feb-06, at 6:35 AM, Nathaniel S. H. Brown wrote:> Just nailed it down to having a "/" in the controller. > > If you even trying: > > render_component :controller => "/blog", :action => "list" > > It will produce an error saying it cant find ::Blog > > -Nb > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Nathaniel S. H. Brown http://nshb.net > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > >> -----Original Message----- >> From: rails-core-bounces@lists.rubyonrails.org >> [mailto:rails-core-bounces@lists.rubyonrails.org] On Behalf >> Of Nathaniel S. H. Brown >> Sent: February 10, 2006 6:09 AM >> To: rails-core@lists.rubyonrails.org >> Subject: [Rails-core] [3795] render_component doesn''t work >> with modules? >> >> I just submitted a bug report for the render_component not >> being able to properly find the modules. >> >> I did a pretty detailed search, and wasn''t able to find >> anything in the tracker. Is this something you guys are >> already aware of ? >> >> http://dev.rubyonrails.org/ticket/3795 >> >> -Nb >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> Nathaniel S. H. Brown http://nshb.net >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> _______________________________________________ >> Rails-core mailing list >> Rails-core@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-core >> > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core-- Trevor Squires http://somethinglearned.com
On 2/10/06, Trevor Squires <trevor@protocool.com> wrote:> Hi Nathaniel, > > I''m using a version of edge (not the most recent, but after module > namespace support was improved) and I use render_component into a > module namespace quite extensively with no problems. > > I know you said you "nailed it down to having a ''/'' in the > controller" but are you sure it''s not simply the *leading* slash > character that''s giving you problems? > > Regards, > TrevorThis might be related to changeset [3563] (http://dev.rubyonrails.org/changeset/3563). When I get some time I''ll dig into the issue if no one else has by then. -- Rick Olson http://techno-weenie.net
Trevor Squires
2006-Feb-10 16:31 UTC
Re: [3795] render_component doesn''t work with modules?
Rick, I''m not sure that changeset is the issue. As I said before, a *leading* slash will give you problems. If you look at the stack trace (assuming I''m recreating Nathaniel''s problem correctly) it says the error is thrown in Inflector#constantize. That bit of code expressly *forbids* leading :: characters in the constant name being resolved and you can see it in action in the console simply by typing: "/foo/bar".camelize.constantize I''m not sure, but I don''t recall a leading ''/'' in a render_component call *ever* working for me... Regards, Trevor On 10-Feb-06, at 7:27 AM, Rick Olson wrote:> On 2/10/06, Trevor Squires <trevor@protocool.com> wrote: >> Hi Nathaniel, >> >> I''m using a version of edge (not the most recent, but after module >> namespace support was improved) and I use render_component into a >> module namespace quite extensively with no problems. >> >> I know you said you "nailed it down to having a ''/'' in the >> controller" but are you sure it''s not simply the *leading* slash >> character that''s giving you problems? >> >> Regards, >> Trevor > > This might be related to changeset [3563] > (http://dev.rubyonrails.org/changeset/3563). When I get some time > I''ll dig into the issue if no one else has by then. > > -- > Rick Olson > http://techno-weenie.net > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
Nathaniel S. H. Brown
2006-Feb-11 04:02 UTC
RE: [3795] render_component doesn''t work with modules?
I originally tried the render_component ''admin/blog'', when viewing a page within the ''admin/someothercontroller'', and had the same issue. When I did further tests, I found that both ''admin/blog'' and ''/admin/blog'' replicated the same error abut the inflector. I haven''t tried with edge, but was planning on later on this weekend as I want to get RJS rolling. Also, David, I just read on your archives, that you like to stick to the "Release often" mantra. Any idea when 1.1 is coming? :) Would be great to get the RJS templates by default. -Nb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> -----Original Message----- > From: rails-core-bounces@lists.rubyonrails.org > [mailto:rails-core-bounces@lists.rubyonrails.org] On Behalf > Of Trevor Squires > Sent: February 10, 2006 8:32 AM > To: rails-core@lists.rubyonrails.org > Subject: Re: [Rails-core] [3795] render_component doesn''t > work with modules? > > Rick, > > I''m not sure that changeset is the issue. As I said before, a > *leading* slash will give you problems. > > If you look at the stack trace (assuming I''m recreating > Nathaniel''s problem correctly) it says the error is thrown in > Inflector#constantize. > > That bit of code expressly *forbids* leading :: characters in > the constant name being resolved and you can see it in action > in the console simply by typing: > > "/foo/bar".camelize.constantize > > I''m not sure, but I don''t recall a leading ''/'' in a > render_component call *ever* working for me... > > Regards, > Trevor > > On 10-Feb-06, at 7:27 AM, Rick Olson wrote: > > > On 2/10/06, Trevor Squires <trevor@protocool.com> wrote: > >> Hi Nathaniel, > >> > >> I''m using a version of edge (not the most recent, but after module > >> namespace support was improved) and I use render_component into a > >> module namespace quite extensively with no problems. > >> > >> I know you said you "nailed it down to having a ''/'' in the > >> controller" but are you sure it''s not simply the *leading* slash > >> character that''s giving you problems? > >> > >> Regards, > >> Trevor > > > > This might be related to changeset [3563] > > (http://dev.rubyonrails.org/changeset/3563). When I get some time > > I''ll dig into the issue if no one else has by then. > > > > -- > > Rick Olson > > http://techno-weenie.net > > _______________________________________________ > > Rails-core mailing list > > Rails-core@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >
Rick Olson wrote:> On 2/10/06, Trevor Squires <trevor@protocool.com> wrote: > >> Hi Nathaniel, >> >> I''m using a version of edge (not the most recent, but after module >> namespace support was improved) and I use render_component into a >> module namespace quite extensively with no problems. >> >> I know you said you "nailed it down to having a ''/'' in the >> controller" but are you sure it''s not simply the *leading* slash >> character that''s giving you problems? >> >> Regards, >> Trevor >> > > This might be related to changeset [3563] > (http://dev.rubyonrails.org/changeset/3563). When I get some time > I''ll dig into the issue if no one else has by then. > > -- > Rick Olson > http://techno-weenie.net > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > >This is a bug in the constantize implementation. I suggest to change it to the following code, which apart from fixing the bug, is a faster as well: def constantize(camel_cased_word) begin if camel_cased_word[0, 2] == ''::'' Object.module_eval(camel_cased_word, __FILE__, __LINE__) else Object.module_eval("::#{camel_cased_word}", __FILE__, __LINE__) end rescue NameError, SyntaxError raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!" end end See ticket http://dev.rubyonrails.org/ticket/3803 -- stefan -- For rails performance tuning, see: http://railsexpress.de/blog Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml