From ruby at monnet-usa.com Fri Feb 4 19:37:55 2011 From: ruby at monnet-usa.com (Philippe Monnet) Date: Fri, 04 Feb 2011 17:37:55 -0700 Subject: Did not know you could provide a list of urls in a controller route declaration Message-ID: <4D4C9BE3.1070306@monnet-usa.com> I just discovered today that I could specify multiple routes in a controller declaration: class Welcome < R '/welcome', '/WelcomeEveryone' end What other features am I missing out on? ;-) @techarch -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcfiredrill at gmail.com Wed Feb 9 19:51:54 2011 From: mcfiredrill at gmail.com (Tony Miller) Date: Wed, 9 Feb 2011 16:51:54 -0800 Subject: Did not know you could provide a list of urls in a controller route declaration In-Reply-To: <4D4C9BE3.1070306@monnet-usa.com> References: <4D4C9BE3.1070306@monnet-usa.com> Message-ID: <20110210005154.GA9273@freedrull.xen.prgmr.com> On Fri, Feb 04, 2011 at 05:37:55PM -0700, Philippe Monnet wrote: > > class Welcome < R '/welcome', '/WelcomeEveryone' > end What does this mean, that '/welcome' and '/WelcomeEveryone' will use the exact same controller? How is that useful? -Tony From mcfiredrill at gmail.com Wed Feb 9 19:54:06 2011 From: mcfiredrill at gmail.com (Tony Miller) Date: Wed, 9 Feb 2011 16:54:06 -0800 Subject: controller for all javascript files? Message-ID: I want to use the same controller for every javascript file...so I was thinking something like this? What I'm not sure of is what to pass to File.read. class Javascript < R '/*.js' JS = File.read() def get @headers['Content-Type'] = 'text/javascript; charset=utf-8' JS end end Is there a better way to do this? I was looking at adam's project: https://github.com/minikomi/tokyoartparties/blob/master/src/Drinking.rb and I didn't see a controller for his css, so I'm kind of wondering how he does it... Thanks, -Tony From a at creativepony.com Wed Feb 9 20:03:37 2011 From: a at creativepony.com (Jenna Fox) Date: Thu, 10 Feb 2011 12:03:37 +1100 Subject: Did not know you could provide a list of urls in a controller route declaration In-Reply-To: <20110210005154.GA9273@freedrull.xen.prgmr.com> References: <4D4C9BE3.1070306@monnet-usa.com> <20110210005154.GA9273@freedrull.xen.prgmr.com> Message-ID: <7CF4099A12A0405B884F53FEF8141372@creativepony.com> Good for maintaining legacy URLs. :) ?Jenna / @Bluebie On Thursday, 10 February 2011 at 11:51 AM, Tony Miller wrote: > On Fri, Feb 04, 2011 at 05:37:55PM -0700, Philippe Monnet wrote: > > > > class Welcome < R '/welcome', '/WelcomeEveryone' > > end > > What does this mean, that '/welcome' and '/WelcomeEveryone' will use the exact same controller? How is that useful? > > -Tony > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From a at creativepony.com Wed Feb 9 20:23:58 2011 From: a at creativepony.com (Jenna Fox) Date: Thu, 10 Feb 2011 12:23:58 +1100 Subject: controller for all javascript files? In-Reply-To: References: Message-ID: class LoadScript < R '/(.*).js' def get(script) @headers['Content-Type'] = 'text/javascript; charset=utf-8' return File.read("my scripts/#{script}.js"); end end Keep in mind the R constructor takes a regexp, and passes the bracketed sections as arguments to the get, post, put, etc... methods on the class when called. ?Jenna / @Bluebie On Thursday, 10 February 2011 at 11:54 AM, Tony Miller wrote: > I want to use the same controller for every javascript file...so I was > thinking something like this? What I'm not sure of is what to pass to > File.read. > > class Javascript < R '/*.js' > JS = File.read() > def get > @headers['Content-Type'] = 'text/javascript; charset=utf-8' > JS > end > end > > Is there a better way to do this? I was looking at adam's project: > https://github.com/minikomi/tokyoartparties/blob/master/src/Drinking.rb > and I didn't see a controller for his css, so I'm kind of wondering > how he does it... > > Thanks, > -Tony > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcfiredrill at gmail.com Wed Feb 9 22:53:06 2011 From: mcfiredrill at gmail.com (Tony Miller) Date: Wed, 9 Feb 2011 19:53:06 -0800 Subject: controller for all javascript files? In-Reply-To: References: Message-ID: Thanks Jenna, this works great! I think I understand how the R constructor works a little more now... On Wed, Feb 9, 2011 at 5:23 PM, Jenna Fox wrote: > class LoadScript < R '/(.*).js' > def get(script) > @headers['Content-Type'] = 'text/javascript; charset=utf-8' > return File.read("my scripts/#{script}.js"); > end > end > Keep in mind the R constructor takes a regexp, and passes the bracketed > sections as arguments to the get, post, put, etc... methods on the class > when called. > > ? > Jenna / @Bluebie > > On Thursday, 10 February 2011 at 11:54 AM, Tony Miller wrote: > > I want to use the same controller for every javascript file...so I was > thinking something like this? What I'm not sure of is what to pass to > File.read. > > class Javascript < R '/*.js' > JS = File.read() > def get > @@headers['Content-Type'] = 'text/javascript; charset=utf-8' > JS > end > end > > Is there a better way to do this? I was looking at adam's project: > https://github.com/minikomi/tokyoartparties/blob/master/src/Drinking.rb > and I didn't see a controller for his css, so I'm kind of wondering > how he does it... > > Thanks, > -Tony > _______________________________________________ > 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 > From a at creativepony.com Wed Feb 9 23:15:00 2011 From: a at creativepony.com (Jenna Fox) Date: Thu, 10 Feb 2011 15:15:00 +1100 Subject: controller for all javascript files? In-Reply-To: References: Message-ID: Glad I could help. :) ?Jenna / @Bluebie On Thursday, 10 February 2011 at 2:53 PM, Tony Miller wrote: > Thanks Jenna, this works great! I think I understand how the R > constructor works a little more now... > > On Wed, Feb 9, 2011 at 5:23 PM, Jenna Fox wrote: > > class LoadScript < R '/(.*).js' > > def get(script) > > @headers['Content-Type'] = 'text/javascript; charset=utf-8' > > return File.read("my scripts/#{script}.js"); > > end > > end > > Keep in mind the R constructor takes a regexp, and passes the bracketed > > sections as arguments to the get, post, put, etc... methods on the class > > when called. > > > > ? > > Jenna / @Bluebie > > > > On Thursday, 10 February 2011 at 11:54 AM, Tony Miller wrote: > > > > I want to use the same controller for every javascript file...so I was > > thinking something like this? What I'm not sure of is what to pass to > > File.read. > > > > class Javascript < R '/*.js' > > JS = File.read() > > def get > > @@headers['Content-Type'] = 'text/javascript; charset=utf-8' > > JS > > end > > end > > > > Is there a better way to do this? I was looking at adam's project: > > https://github.com/minikomi/tokyoartparties/blob/master/src/Drinking.rb > > and I didn't see a controller for his css, so I'm kind of wondering > > how he does it... > > > > Thanks, > > -Tony > > _______________________________________________ > > 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 > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nerdfunk at gmail.com Wed Feb 9 23:57:25 2011 From: nerdfunk at gmail.com (adam moore) Date: Thu, 10 Feb 2011 13:57:25 +0900 Subject: Did not know you could provide a list of urls in a controller route declaration In-Reply-To: <7CF4099A12A0405B884F53FEF8141372@creativepony.com> References: <4D4C9BE3.1070306@monnet-usa.com> <20110210005154.GA9273@freedrull.xen.prgmr.com> <7CF4099A12A0405B884F53FEF8141372@creativepony.com> Message-ID: Commun spelling errars... 2011?2?10???? Jenna Fox a at creativepony.com: > > > Good for maintaining legacy URLs. :) > > > ?Jenna / @Bluebie > > > > On Thursday, 10 February 2011 at 11:51 AM, Tony Miller wrote: > > On Fri, Feb 04, 2011 at 05:37:55PM -0700, Philippe Monnet wrote: > > class Welcome < R '/welcome', '/WelcomeEveryone' > end > > What does this mean, that '/welcome' and '/WelcomeEveryone' will use the exact same controller? How is that useful? > > -Tony > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > > > > > > > > > > > -- ----=^.^=--- From matthias at waechter.wiz.at Thu Feb 10 03:34:08 2011 From: matthias at waechter.wiz.at (=?UTF-8?B?TWF0dGhpYXMgV8OkY2h0ZXI=?=) Date: Thu, 10 Feb 2011 09:34:08 +0100 Subject: controller for all javascript files? In-Reply-To: References: Message-ID: <4D53A300.7090600@waechter.wiz.at> On 10.02.2011 02:23, Jenna Fox wrote: > class LoadScript < R '/(.*).js' > def get(script) > @headers['Content-Type'] = 'text/javascript; charset=utf-8' > return File.read("my scripts/#{script}.js"); > end > end remember [http://en.wikipedia.org/wiki/Directory_traversal] ? even if you accor access to just .js files it?s not good practice to use ?script? unchecked. ? Matthias From matthias at waechter.wiz.at Thu Feb 10 03:58:16 2011 From: matthias at waechter.wiz.at (=?UTF-8?B?TWF0dGhpYXMgV8OkY2h0ZXI=?=) Date: Thu, 10 Feb 2011 09:58:16 +0100 Subject: controller for all javascript files? In-Reply-To: <4D53A300.7090600@waechter.wiz.at> References: <4D53A300.7090600@waechter.wiz.at> Message-ID: <4D53A8A8.9020504@waechter.wiz.at> On 10.02.2011 09:34, Matthias W?chter wrote: > [?] even if you accor access to just .js files [?] Don?t know how I typed this ? :) Meant: even if you limit access to just .js files ? Matthias