When using Tilt for views I need to completely specify the controller within the template file. For example, in a Markaby view I can do this: URL(LogIn) But in a template file I have to do this: URL(MyApp::Controllers::LogIn) Is there anyway around this? -- Dave
This is a well-known bug in Tilt: http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f The thread includes a quite simple patch for 1.8, and a larger, very hackish patch for 1.8+1.9. // Magnus Holm On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote:> When using Tilt for views I need to completely specify the controller > within the template file. > > For example, in a Markaby view I can do this: > > URL(LogIn) > > But in a template file I have to do this: > > URL(MyApp::Controllers::LogIn) > > Is there anyway around this? > > -- > Dave > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
Here''s an updated patch which include comments and doesn''t leak on 1.9: http://gist.github.com/485111 // Magnus Holm On Wed, Jul 21, 2010 at 21:29, Magnus Holm <judofyr at gmail.com> wrote:> This is a well-known bug in Tilt: > http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f > > The thread includes a quite simple patch for 1.8, and a larger, very > hackish patch for 1.8+1.9. > > > // Magnus Holm > > > > On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >> When using Tilt for views I need to completely specify the controller >> within the template file. >> >> For example, in a Markaby view I can do this: >> >> URL(LogIn) >> >> But in a template file I have to do this: >> >> URL(MyApp::Controllers::LogIn) >> >> Is there anyway around this? >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> >
Thanks Magnus, I gave that a shot but I''m still getting an argument error: Anonymous modules have no name to be referenced by I''m trying to wrap my mind around what this patch is doing, but I don''t see the connection between constants and a reference to a controller. Dave On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote:> This is a well-known bug in Tilt: > http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f > > The thread includes a quite simple patch for 1.8, and a larger, very > hackish patch for 1.8+1.9. > > > // Magnus Holm > > > > On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >> When using Tilt for views I need to completely specify the controller >> within the template file. >> >> For example, in a Markaby view I can do this: >> >> URL(LogIn) >> >> But in a template file I have to do this: >> >> URL(MyApp::Controllers::LogIn) >> >> Is there anyway around this? >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Dave
A reference to a controller is also a constant. Everything which starts with an uppercase letter is in fact a constant. Hm. Could you give me a backtrace? It seems like it''s ActiveSupport''s const_missing or something like that. You don''t really need to read/understand all those comments in the patch. It''s all related to the fact that Tilt defines the template as a method under the Tilt::CompileSite (which is included in each request in Camping) so when you call #render it actually calls a method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a method is way faster than instance_eval, so this gives a significant speed improvement. The problem by defining the method under Tilt::CompileSite is that constant lookup is now relative to Tilt::CompileSite instead of your request. This is what the patch fixes. // Magnus Holm On Wed, Jul 21, 2010 at 22:53, David Susco <dsusco at gmail.com> wrote:> Thanks Magnus, > > I gave that a shot but I''m still getting an argument error: > > Anonymous modules have no name to be referenced by > > I''m trying to wrap my mind around what this patch is doing, but I > don''t see the connection between constants and a reference to a > controller. > > Dave > > On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote: >> This is a well-known bug in Tilt: >> http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f >> >> The thread includes a quite simple patch for 1.8, and a larger, very >> hackish patch for 1.8+1.9. >> >> >> // Magnus Holm >> >> >> >> On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >>> When using Tilt for views I need to completely specify the controller >>> within the template file. >>> >>> For example, in a Markaby view I can do this: >>> >>> URL(LogIn) >>> >>> But in a template file I have to do this: >>> >>> URL(MyApp::Controllers::LogIn) >>> >>> Is there anyway around this? >>> >>> -- >>> Dave >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > > > > -- > Dave > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
Hey Magnus, I patched the files and it''s still the same thing. Here''s the backtrace, let me know if you want browser dump as well. 127.0.0.1 - - [23/Jul/2010 11:48:39] "GET /Home HTTP/1.1" 500 95353 0.3607 ArgumentError: Anonymous modules have no name to be referenced by /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in `to_constant_name'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in `qualified_name_for'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in `const_missing'' /var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'' /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in `evaluate'' /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in `evaluate'' /usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in `render'' (eval):15:in `render'' (eval):15:in `render'' ./riki/controllers.rb:85:in `get'' (eval):27:in `send'' (eval):27:in `service'' (eval):27:in `catch'' (eval):27:in `service'' (eval):38:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in `call'' (eval):42:in `call'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in `run'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9 /usr/local/bin/camping:19:in `load'' /usr/local/bin/camping:19 On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm <judofyr at gmail.com> wrote:> A reference to a controller is also a constant. Everything which > starts with an uppercase letter is in fact a constant. > > Hm. Could you give me a backtrace? It seems like it''s ActiveSupport''s > const_missing or something like that. > > You don''t really need to read/understand all those comments in the > patch. It''s all related to the fact that Tilt defines the template as > a method under the Tilt::CompileSite (which is included in each > request in Camping) so when you call #render it actually calls a > method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a > method is way faster than instance_eval, so this gives a significant > speed improvement. The problem by defining the method under > Tilt::CompileSite is that constant lookup is now relative to > Tilt::CompileSite instead of your request. This is what the patch > fixes. > > // Magnus Holm > > > > On Wed, Jul 21, 2010 at 22:53, David Susco <dsusco at gmail.com> wrote: >> Thanks Magnus, >> >> I gave that a shot but I''m still getting an argument error: >> >> Anonymous modules have no name to be referenced by >> >> I''m trying to wrap my mind around what this patch is doing, but I >> don''t see the connection between constants and a reference to a >> controller. >> >> Dave >> >> On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote: >>> This is a well-known bug in Tilt: >>> http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f >>> >>> The thread includes a quite simple patch for 1.8, and a larger, very >>> hackish patch for 1.8+1.9. >>> >>> >>> // Magnus Holm >>> >>> >>> >>> On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >>>> When using Tilt for views I need to completely specify the controller >>>> within the template file. >>>> >>>> For example, in a Markaby view I can do this: >>>> >>>> URL(LogIn) >>>> >>>> But in a template file I have to do this: >>>> >>>> URL(MyApp::Controllers::LogIn) >>>> >>>> Is there anyway around this? >>>> >>>> -- >>>> Dave >>>> _______________________________________________ >>>> Camping-list mailing list >>>> Camping-list at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/camping-list >>>> >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> >> >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Dave
Wait, forget about that Tilt patch. Try this instead: module App include X end // Magnus Holm On Fri, Jul 23, 2010 at 18:01, David Susco <dsusco at gmail.com> wrote:> Hey Magnus, I patched the files and it''s still the same thing. Here''s > the backtrace, let me know if you want browser dump as well. > > 127.0.0.1 - - [23/Jul/2010 11:48:39] "GET /Home HTTP/1.1" 500 95353 0.3607 > ArgumentError: Anonymous modules have no name to be referenced by > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in > `to_constant_name'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in > `qualified_name_for'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in > `const_missing'' > ? ? ? ?/var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in `evaluate'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in `evaluate'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in `render'' > ? ? ? ?(eval):15:in `render'' > ? ? ? ?(eval):15:in `render'' > ? ? ? ?./riki/controllers.rb:85:in `get'' > ? ? ? ?(eval):27:in `send'' > ? ? ? ?(eval):27:in `service'' > ? ? ? ?(eval):27:in `catch'' > ? ? ? ?(eval):27:in `service'' > ? ? ? ?(eval):38:in `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in > `call'' > ? ? ? ?(eval):42:in `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in > `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in > `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in > `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in > `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in > `call'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in > `service'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' > ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in > `run'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in > `start'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'' > ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9 > ? ? ? ?/usr/local/bin/camping:19:in `load'' > ? ? ? ?/usr/local/bin/camping:19 > > > On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm <judofyr at gmail.com> wrote: >> A reference to a controller is also a constant. Everything which >> starts with an uppercase letter is in fact a constant. >> >> Hm. Could you give me a backtrace? It seems like it''s ActiveSupport''s >> const_missing or something like that. >> >> You don''t really need to read/understand all those comments in the >> patch. It''s all related to the fact that Tilt defines the template as >> a method under the Tilt::CompileSite (which is included in each >> request in Camping) so when you call #render it actually calls a >> method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a >> method is way faster than instance_eval, so this gives a significant >> speed improvement. The problem by defining the method under >> Tilt::CompileSite is that constant lookup is now relative to >> Tilt::CompileSite instead of your request. This is what the patch >> fixes. >> >> // Magnus Holm >> >> >> >> On Wed, Jul 21, 2010 at 22:53, David Susco <dsusco at gmail.com> wrote: >>> Thanks Magnus, >>> >>> I gave that a shot but I''m still getting an argument error: >>> >>> Anonymous modules have no name to be referenced by >>> >>> I''m trying to wrap my mind around what this patch is doing, but I >>> don''t see the connection between constants and a reference to a >>> controller. >>> >>> Dave >>> >>> On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote: >>>> This is a well-known bug in Tilt: >>>> http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f >>>> >>>> The thread includes a quite simple patch for 1.8, and a larger, very >>>> hackish patch for 1.8+1.9. >>>> >>>> >>>> // Magnus Holm >>>> >>>> >>>> >>>> On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >>>>> When using Tilt for views I need to completely specify the controller >>>>> within the template file. >>>>> >>>>> For example, in a Markaby view I can do this: >>>>> >>>>> URL(LogIn) >>>>> >>>>> But in a template file I have to do this: >>>>> >>>>> URL(MyApp::Controllers::LogIn) >>>>> >>>>> Is there anyway around this? >>>>> >>>>> -- >>>>> Dave >>>>> _______________________________________________ >>>>> Camping-list mailing list >>>>> Camping-list at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>> >>>> _______________________________________________ >>>> Camping-list mailing list >>>> Camping-list at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/camping-list >>>> >>> >>> >>> >>> -- >>> Dave >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > > > > -- > Dave > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
lol, at first I thought you were messing with me. X is the apps Controllers module, correct? Will I always have to do this when using Tilt? Or only until this patch makes it into a gem? Dave On Fri, Jul 23, 2010 at 3:09 PM, Magnus Holm <judofyr at gmail.com> wrote:> Wait, forget about that Tilt patch. Try this instead: > > ?module App > ? ?include X > ?end > > // Magnus Holm > > > > On Fri, Jul 23, 2010 at 18:01, David Susco <dsusco at gmail.com> wrote: >> Hey Magnus, I patched the files and it''s still the same thing. Here''s >> the backtrace, let me know if you want browser dump as well. >> >> 127.0.0.1 - - [23/Jul/2010 11:48:39] "GET /Home HTTP/1.1" 500 95353 0.3607 >> ArgumentError: Anonymous modules have no name to be referenced by >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in >> `to_constant_name'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in >> `qualified_name_for'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in >> `const_missing'' >> ? ? ? ?/var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in `evaluate'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in `evaluate'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in `render'' >> ? ? ? ?(eval):15:in `render'' >> ? ? ? ?(eval):15:in `render'' >> ? ? ? ?./riki/controllers.rb:85:in `get'' >> ? ? ? ?(eval):27:in `send'' >> ? ? ? ?(eval):27:in `service'' >> ? ? ? ?(eval):27:in `catch'' >> ? ? ? ?(eval):27:in `service'' >> ? ? ? ?(eval):38:in `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in >> `call'' >> ? ? ? ?(eval):42:in `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in >> `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in >> `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in >> `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in >> `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in >> `call'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in >> `service'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' >> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in >> `run'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in >> `start'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'' >> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9 >> ? ? ? ?/usr/local/bin/camping:19:in `load'' >> ? ? ? ?/usr/local/bin/camping:19 >> >> >> On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm <judofyr at gmail.com> wrote: >>> A reference to a controller is also a constant. Everything which >>> starts with an uppercase letter is in fact a constant. >>> >>> Hm. Could you give me a backtrace? It seems like it''s ActiveSupport''s >>> const_missing or something like that. >>> >>> You don''t really need to read/understand all those comments in the >>> patch. It''s all related to the fact that Tilt defines the template as >>> a method under the Tilt::CompileSite (which is included in each >>> request in Camping) so when you call #render it actually calls a >>> method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a >>> method is way faster than instance_eval, so this gives a significant >>> speed improvement. The problem by defining the method under >>> Tilt::CompileSite is that constant lookup is now relative to >>> Tilt::CompileSite instead of your request. This is what the patch >>> fixes. >>> >>> // Magnus Holm >>> >>> >>> >>> On Wed, Jul 21, 2010 at 22:53, David Susco <dsusco at gmail.com> wrote: >>>> Thanks Magnus, >>>> >>>> I gave that a shot but I''m still getting an argument error: >>>> >>>> Anonymous modules have no name to be referenced by >>>> >>>> I''m trying to wrap my mind around what this patch is doing, but I >>>> don''t see the connection between constants and a reference to a >>>> controller. >>>> >>>> Dave >>>> >>>> On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote: >>>>> This is a well-known bug in Tilt: >>>>> http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f >>>>> >>>>> The thread includes a quite simple patch for 1.8, and a larger, very >>>>> hackish patch for 1.8+1.9. >>>>> >>>>> >>>>> // Magnus Holm >>>>> >>>>> >>>>> >>>>> On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >>>>>> When using Tilt for views I need to completely specify the controller >>>>>> within the template file. >>>>>> >>>>>> For example, in a Markaby view I can do this: >>>>>> >>>>>> URL(LogIn) >>>>>> >>>>>> But in a template file I have to do this: >>>>>> >>>>>> URL(MyApp::Controllers::LogIn) >>>>>> >>>>>> Is there anyway around this? >>>>>> >>>>>> -- >>>>>> Dave >>>>>> _______________________________________________ >>>>>> Camping-list mailing list >>>>>> Camping-list at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>>> >>>>> _______________________________________________ >>>>> Camping-list mailing list >>>>> Camping-list at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>> >>>> >>>> >>>> >>>> -- >>>> Dave >>>> _______________________________________________ >>>> Camping-list mailing list >>>> Camping-list at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/camping-list >>>> >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> >> >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-- Dave
You''ll have to agree that "include X" sounds so much better than "include Controllers"? :-) Could you test one more thing for me? Without a Tilt patch, can you add `require ''camping/templates''` right after `require ''camping''` and check if it still works? Here you go: `gem install camping --source http://gems.judofyr.net/` // Magnus Holm On Fri, Jul 23, 2010 at 21:48, David Susco <dsusco at gmail.com> wrote:> lol, at first I thought you were messing with me. X is the apps > Controllers module, correct? > > Will I always have to do this when using Tilt? Or only until this > patch makes it into a gem? > > Dave > > On Fri, Jul 23, 2010 at 3:09 PM, Magnus Holm <judofyr at gmail.com> wrote: >> Wait, forget about that Tilt patch. Try this instead: >> >> ?module App >> ? ?include X >> ?end >> >> // Magnus Holm >> >> >> >> On Fri, Jul 23, 2010 at 18:01, David Susco <dsusco at gmail.com> wrote: >>> Hey Magnus, I patched the files and it''s still the same thing. Here''s >>> the backtrace, let me know if you want browser dump as well. >>> >>> 127.0.0.1 - - [23/Jul/2010 11:48:39] "GET /Home HTTP/1.1" 500 95353 0.3607 >>> ArgumentError: Anonymous modules have no name to be referenced by >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in >>> `to_constant_name'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in >>> `qualified_name_for'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in >>> `const_missing'' >>> ? ? ? ?/var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in `evaluate'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in `evaluate'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in `render'' >>> ? ? ? ?(eval):15:in `render'' >>> ? ? ? ?(eval):15:in `render'' >>> ? ? ? ?./riki/controllers.rb:85:in `get'' >>> ? ? ? ?(eval):27:in `send'' >>> ? ? ? ?(eval):27:in `service'' >>> ? ? ? ?(eval):27:in `catch'' >>> ? ? ? ?(eval):27:in `service'' >>> ? ? ? ?(eval):38:in `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in >>> `call'' >>> ? ? ? ?(eval):42:in `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in >>> `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in >>> `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in >>> `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in >>> `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in >>> `call'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in >>> `service'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in >>> `run'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in >>> `start'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'' >>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9 >>> ? ? ? ?/usr/local/bin/camping:19:in `load'' >>> ? ? ? ?/usr/local/bin/camping:19 >>> >>> >>> On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm <judofyr at gmail.com> wrote: >>>> A reference to a controller is also a constant. Everything which >>>> starts with an uppercase letter is in fact a constant. >>>> >>>> Hm. Could you give me a backtrace? It seems like it''s ActiveSupport''s >>>> const_missing or something like that. >>>> >>>> You don''t really need to read/understand all those comments in the >>>> patch. It''s all related to the fact that Tilt defines the template as >>>> a method under the Tilt::CompileSite (which is included in each >>>> request in Camping) so when you call #render it actually calls a >>>> method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a >>>> method is way faster than instance_eval, so this gives a significant >>>> speed improvement. The problem by defining the method under >>>> Tilt::CompileSite is that constant lookup is now relative to >>>> Tilt::CompileSite instead of your request. This is what the patch >>>> fixes. >>>> >>>> // Magnus Holm >>>> >>>> >>>> >>>> On Wed, Jul 21, 2010 at 22:53, David Susco <dsusco at gmail.com> wrote: >>>>> Thanks Magnus, >>>>> >>>>> I gave that a shot but I''m still getting an argument error: >>>>> >>>>> Anonymous modules have no name to be referenced by >>>>> >>>>> I''m trying to wrap my mind around what this patch is doing, but I >>>>> don''t see the connection between constants and a reference to a >>>>> controller. >>>>> >>>>> Dave >>>>> >>>>> On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote: >>>>>> This is a well-known bug in Tilt: >>>>>> http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f >>>>>> >>>>>> The thread includes a quite simple patch for 1.8, and a larger, very >>>>>> hackish patch for 1.8+1.9. >>>>>> >>>>>> >>>>>> // Magnus Holm >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >>>>>>> When using Tilt for views I need to completely specify the controller >>>>>>> within the template file. >>>>>>> >>>>>>> For example, in a Markaby view I can do this: >>>>>>> >>>>>>> URL(LogIn) >>>>>>> >>>>>>> But in a template file I have to do this: >>>>>>> >>>>>>> URL(MyApp::Controllers::LogIn) >>>>>>> >>>>>>> Is there anyway around this? >>>>>>> >>>>>>> -- >>>>>>> Dave >>>>>>> _______________________________________________ >>>>>>> Camping-list mailing list >>>>>>> Camping-list at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>>>> >>>>>> _______________________________________________ >>>>>> Camping-list mailing list >>>>>> Camping-list at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Dave >>>>> _______________________________________________ >>>>> Camping-list mailing list >>>>> Camping-list at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>> >>>> _______________________________________________ >>>> Camping-list mailing list >>>> Camping-list at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/camping-list >>>> >>> >>> >>> >>> -- >>> Dave >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list > > > > -- > Dave > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
Alright I updated camping to .405, did a pristine on Tilt (v1.0.1), removed the include X from my Base module and my controllers are still being found (no anonymous modules errors). Re: your test, I required camping/template and got this: NameError: uninitialized constant Riki::Base::Template /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'' (eval):13:in `lookup'' (eval):12:in `fetch'' (eval):12:in `lookup'' (eval):15:in `render'' ./riki/controllers.rb:11:in `get'' (eval):28:in `send'' (eval):28:in `service'' (eval):28:in `catch'' (eval):28:in `service'' (eval):39:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in `call'' (eval):43:in `call'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/../lib/camping/server.rb:176:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/../lib/camping/server.rb:242:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in `run'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/../lib/camping/server.rb:144:in `start'' /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'' /usr/local/lib/ruby/gems/1.8/gems/camping-2.0.405/bin/camping:9 /usr/local/bin/camping:19:in `load'' /usr/local/bin/camping:19 On Fri, Jul 23, 2010 at 5:44 PM, Magnus Holm <judofyr at gmail.com> wrote:> You''ll have to agree that "include X" sounds so much better than > "include Controllers"? :-) > > Could you test one more thing for me? Without a Tilt patch, can you > add `require ''camping/templates''` right after `require ''camping''` and > check if it still works? > > Here you go: `gem install camping --source http://gems.judofyr.net/` > > // Magnus Holm > > > > On Fri, Jul 23, 2010 at 21:48, David Susco <dsusco at gmail.com> wrote: >> lol, at first I thought you were messing with me. X is the apps >> Controllers module, correct? >> >> Will I always have to do this when using Tilt? Or only until this >> patch makes it into a gem? >> >> Dave >> >> On Fri, Jul 23, 2010 at 3:09 PM, Magnus Holm <judofyr at gmail.com> wrote: >>> Wait, forget about that Tilt patch. Try this instead: >>> >>> ?module App >>> ? ?include X >>> ?end >>> >>> // Magnus Holm >>> >>> >>> >>> On Fri, Jul 23, 2010 at 18:01, David Susco <dsusco at gmail.com> wrote: >>>> Hey Magnus, I patched the files and it''s still the same thing. Here''s >>>> the backtrace, let me know if you want browser dump as well. >>>> >>>> 127.0.0.1 - - [23/Jul/2010 11:48:39] "GET /Home HTTP/1.1" 500 95353 0.3607 >>>> ArgumentError: Anonymous modules have no name to be referenced by >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:585:in >>>> `to_constant_name'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:391:in >>>> `qualified_name_for'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:104:in >>>> `const_missing'' >>>> ? ? ? ?/var/www/apps/crud/riki/views/layout.haml:23:in `evaluate_source'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:195:in `evaluate'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:560:in `evaluate'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/tilt-1.0.1/lib/tilt.rb:128:in `render'' >>>> ? ? ? ?(eval):15:in `render'' >>>> ? ? ? ?(eval):15:in `render'' >>>> ? ? ? ?./riki/controllers.rb:85:in `get'' >>>> ? ? ? ?(eval):27:in `send'' >>>> ? ? ? ?(eval):27:in `service'' >>>> ? ? ? ?(eval):27:in `catch'' >>>> ? ? ? ?(eval):27:in `service'' >>>> ? ? ? ?(eval):38:in `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/session/cookie.rb:37:in >>>> `call'' >>>> ? ? ? ?(eval):42:in `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:176:in >>>> `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:47:in `_call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lint.rb:35:in `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb:24:in >>>> `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in >>>> `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:242:in >>>> `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in >>>> `call'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in >>>> `service'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:14:in >>>> `run'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/../lib/camping/server.rb:144:in >>>> `start'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'' >>>> ? ? ? ?/usr/local/lib/ruby/gems/1.8/gems/camping-2.0.392/bin/camping:9 >>>> ? ? ? ?/usr/local/bin/camping:19:in `load'' >>>> ? ? ? ?/usr/local/bin/camping:19 >>>> >>>> >>>> On Wed, Jul 21, 2010 at 5:26 PM, Magnus Holm <judofyr at gmail.com> wrote: >>>>> A reference to a controller is also a constant. Everything which >>>>> starts with an uppercase letter is in fact a constant. >>>>> >>>>> Hm. Could you give me a backtrace? It seems like it''s ActiveSupport''s >>>>> const_missing or something like that. >>>>> >>>>> You don''t really need to read/understand all those comments in the >>>>> patch. It''s all related to the fact that Tilt defines the template as >>>>> a method under the Tilt::CompileSite (which is included in each >>>>> request in Camping) so when you call #render it actually calls a >>>>> method called #_tilt_ajdbakjasjdbakjsbdk in the background. Calling a >>>>> method is way faster than instance_eval, so this gives a significant >>>>> speed improvement. The problem by defining the method under >>>>> Tilt::CompileSite is that constant lookup is now relative to >>>>> Tilt::CompileSite instead of your request. This is what the patch >>>>> fixes. >>>>> >>>>> // Magnus Holm >>>>> >>>>> >>>>> >>>>> On Wed, Jul 21, 2010 at 22:53, David Susco <dsusco at gmail.com> wrote: >>>>>> Thanks Magnus, >>>>>> >>>>>> I gave that a shot but I''m still getting an argument error: >>>>>> >>>>>> Anonymous modules have no name to be referenced by >>>>>> >>>>>> I''m trying to wrap my mind around what this patch is doing, but I >>>>>> don''t see the connection between constants and a reference to a >>>>>> controller. >>>>>> >>>>>> Dave >>>>>> >>>>>> On Wed, Jul 21, 2010 at 3:29 PM, Magnus Holm <judofyr at gmail.com> wrote: >>>>>>> This is a well-known bug in Tilt: >>>>>>> http://groups.google.com/group/tiltrb/browse_thread/thread/19fef5370c4d417f >>>>>>> >>>>>>> The thread includes a quite simple patch for 1.8, and a larger, very >>>>>>> hackish patch for 1.8+1.9. >>>>>>> >>>>>>> >>>>>>> // Magnus Holm >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, Jul 21, 2010 at 21:05, David Susco <dsusco at gmail.com> wrote: >>>>>>>> When using Tilt for views I need to completely specify the controller >>>>>>>> within the template file. >>>>>>>> >>>>>>>> For example, in a Markaby view I can do this: >>>>>>>> >>>>>>>> URL(LogIn) >>>>>>>> >>>>>>>> But in a template file I have to do this: >>>>>>>> >>>>>>>> URL(MyApp::Controllers::LogIn) >>>>>>>> >>>>>>>> Is there anyway around this? >>>>>>>> >>>>>>>> -- >>>>>>>> Dave >>>>>>>> _______________________________________________ >>>>>>>> Camping-list mailing list >>>>>>>> Camping-list at rubyforge.org >>>>>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> Camping-list mailing list >>>>>>> Camping-list at rubyforge.org >>>>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Dave >>>>>> _______________________________________________ >>>>>> Camping-list mailing list >>>>>> Camping-list at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>>> >>>>> _______________________________________________ >>>>> Camping-list mailing list >>>>> Camping-list at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/camping-list >>>>> >>>> >>>> >>>> >>>> -- >>>> Dave >>>> _______________________________________________ >>>> Camping-list mailing list >>>> Camping-list at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/camping-list >>>> >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >> >> >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-- Dave