From ramolie222 at yahoo.com Wed Nov 1 15:47:51 2006 From: ramolie222 at yahoo.com (ramona guzek) Date: Wed, 1 Nov 2006 12:47:51 -0800 (PST) Subject: mailinglist Message-ID: <20061101204751.98980.qmail@web33004.mail.mud.yahoo.com> ied liketo be put onthe mailing list for campin list Image by FlamingText.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20061101/a51182ce/attachment.html From boss at topfunky.com Fri Nov 3 12:42:12 2006 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Fri, 3 Nov 2006 09:42:12 -0800 Subject: [OT] Markaby trunk and Rails ivars Message-ID: Can someone explain the new Markaby syntax to me? I'm using Markaby as a Rails plugin, fetched from the trunk. I'm losing my instance variables somehow (@thing is always nil): class ThingsController < ApplicationController def index @thing = "Bacon of the chunky variety" end end # app/views/index.mab h1 { "You should see a thing here:" } p { @thing } And I get a NoMethodError when trying to get at it with the thing() method, as mentioned in the README. I can, however, get to the instance variable like this: @thing = @helpers.controller.assigns['thing'] What am I doing wrong? Geoff From twoggle at gmail.com Sat Nov 4 07:21:15 2006 From: twoggle at gmail.com (Tim Fletcher) Date: Sat, 4 Nov 2006 12:21:15 +0000 Subject: [OT] Markaby trunk and Rails ivars In-Reply-To: References: Message-ID: Yeah, this is my fault - sorry for the breakage :) p { thing } should work just fine now (as of r91). The idea behind these recent changes is to keep instance variables for Markaby's own purposes, and force everything else coming in from outside (i.e. controllers) to go through method_missing. The code is a bit cleaner as a result. Any objections to the new style? Tim On 03/11/06, Geoffrey Grosenbach wrote: > Can someone explain the new Markaby syntax to me? I'm using Markaby > as a Rails plugin, fetched from the trunk. > > I'm losing my instance variables somehow (@thing is always nil): > > class ThingsController < ApplicationController > def index > @thing = "Bacon of the chunky variety" > end > end > > # app/views/index.mab > h1 { "You should see a thing here:" } > p { @thing } > > > And I get a NoMethodError when trying to get at it with the thing() > method, as mentioned in the README. > > I can, however, get to the instance variable like this: > > @thing = @helpers.controller.assigns['thing'] > > > What am I doing wrong? > > Geoff > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > From boss at topfunky.com Sat Nov 4 13:24:10 2006 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Sat, 4 Nov 2006 10:24:10 -0800 Subject: [OT] Markaby trunk and Rails ivars In-Reply-To: References: Message-ID: On Nov 4, 2006, at 4:21 AM, Tim Fletcher wrote: > p { thing } should work just fine now (as of r91). Works like a dream now, thanks! Geoff From boss at topfunky.com Sat Nov 4 16:42:58 2006 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Sat, 4 Nov 2006 13:42:58 -0800 Subject: A New App, and A Question Message-ID: <1961FC57-EB78-4A52-B147-1E09BE822710@topfunky.com> Here's my first live Camping app, on the undergroun.d! http://peep.d I often need to come up with a color scheme that is made from an existing color. This little app takes a hex color and shows all the combinations of those colors. An observation and a question: At first it was including dispatch.fcgi into generated urls (http:// peep.d/dispatch.fcgi/colors). I renamed it to dispatch.rb and that helped. However, Camping still adds extra copies of the mount point: http://peep.d/colors/colors/colors/33/55/ff It works, but looks a little odd. I'm using lighttpd with the config from http:// code.whytheluckystiff.net/camping/wiki/TheCampingServerForLighttpd. I only have one route: class Index < R '/', '/colors/(\w\w)/(\w\w)/(\w\w)' The offending link is generated with a splatted array of three strings: R(Index, *color) Does anyone have ideas about what I'm doing wrong? Geoff From zimba.tm at gmail.com Sun Nov 5 04:13:03 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Sun, 5 Nov 2006 10:13:03 +0100 Subject: A New App, and A Question In-Reply-To: <1961FC57-EB78-4A52-B147-1E09BE822710@topfunky.com> References: <1961FC57-EB78-4A52-B147-1E09BE822710@topfunky.com> Message-ID: <3ff63f9b0611050113y29663da2n94b6ebea1ff93d8a@mail.gmail.com> Hi Geoff, really nice idea, it will help me too. To answer your question : Look in the @root instance variable. It is the path to your application's root. We already had some problems with FastCgi -- Cheers, zimbatm http://zimbatm.oree.ch From joeat303 at yahoo.com Sun Nov 5 14:14:05 2006 From: joeat303 at yahoo.com (Joe Ruby) Date: Sun, 5 Nov 2006 11:14:05 -0800 (PST) Subject: Any workaround for Rails caching? Message-ID: <20061105191405.46036.qmail@web38610.mail.mud.yahoo.com> > > I mean fragment caching. I get errors like this: > > > > ActionView::TemplateError > > (/usr/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:192:in > > `method_missing': no such method `length') on line #0 > > of app/views/items/index.mab: > > 1: > > 2: cache("#{@site.server_name}/index_items") do > > > > > > Joe > > Yep, the length error is because a lot of Rails' internals still > assume ERB, which uses a different buffer structure to Markaby. I'll > try to get it working soon. > > Cheers, > Tim Do you have any ideas how to approach it? Looking at Rails' code: # Called by CacheHelper#cache def cache_erb_fragment(block, name = {}, options = nil) unless perform_caching then block.call; return end buffer = eval("_erbout", block.binding) if cache = read_fragment(name, options) buffer.concat(cache) else pos = buffer.length block.call write_fragment(name, buffer[pos..-1], options) end end It seems like Markaby might have to have a "length" attribute and/or act like "buffer"? Or would Rails need to be changed on the eval line? Joe __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From mark.m.fredrickson at gmail.com Tue Nov 14 01:07:39 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Tue, 14 Nov 2006 00:07:39 -0600 Subject: [UHH] any blogs sprung from camping? Message-ID: <3db8a8970611132207l12e31758g623b87e1d46afbf6@mail.gmail.com> Hello, I just joined the camping list. I was trolling the archives when I saw this: -- The biggest problem in Camping is authentication. This is a problem I propose to solve by providing an extension. That little bit of code uses the path to allow/disallow urls. That way it is unobstrusive. In the future I would also like to make an OpenID client and server for Camping. -- I was wondering if anyone had gone down the OpenID client/server route? I'm in the process of writing one myself as a demonstration of camping for my local ruby group. I'm in the process of writing the server, and I think I can supply the client as a mixin. If anyone has done work on this front, I'd be interested to combine efforts. I too see many opportunities for tiny little gnat sized apps working together in glorious harmony. And user auth is certainly the first step. Cheers, -Mark From mark.m.fredrickson at gmail.com Tue Nov 14 01:37:40 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Tue, 14 Nov 2006 00:37:40 -0600 Subject: RESTful mixin, mixin repo? Message-ID: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> Hi, I just put together a little mixin to provide pseudo-RESTful services in camping apps. Basically, it looks for a hidden _verb field in form posts, and sets the @method to the supplied value (e.g. put or delete - which browsers don't support). This lets you define put and delete methods in your controllers. Groovy. Code: http://pastie.caboo.se/22613 Is there any permanent repo of little code snippets/mini-libraries for Camping? Is the wiki the best place? I think a lot of camping code could be re-used via mixins and it would be nice to have a Camping-forge type place to go find existing work. Cheers, -Mark From rramdas at gmail.com Tue Nov 14 02:41:41 2006 From: rramdas at gmail.com (Rodney Ramdas) Date: Tue, 14 Nov 2006 08:41:41 +0100 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> Message-ID: <479cf31b0611132341m6a60c4d4m9c76756d0800f0fb@mail.gmail.com> hey, that's nice perhaps you could write up a page on the wiki ? http://code.whytheluckystiff.net/camping/wiki/LikeRails On 11/14/06, Mark Fredrickson wrote: > Hi, > > I just put together a little mixin to provide pseudo-RESTful services > in camping apps. Basically, it looks for a hidden _verb field in form > posts, and sets the @method to the supplied value (e.g. put or delete > - which browsers don't support). This lets you define put and delete > methods in your controllers. Groovy. > > Code: > > http://pastie.caboo.se/22613 > > Is there any permanent repo of little code snippets/mini-libraries for > Camping? Is the wiki the best place? I think a lot of camping code > could be re-used via mixins and it would be nice to have a > Camping-forge type place to go find existing work. > > Cheers, > -Mark > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -- Rodney http://www.pinupgeek.com http://www.dutchrailers.org From zimba.tm at gmail.com Tue Nov 14 10:40:54 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 14 Nov 2006 16:40:54 +0100 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> Message-ID: <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> Hi, Great ! I wanted to implement that for long time and never had it (the time). I've packages a set of Camping extensions in a package called "Equipment". Apparently I don't have many followers but maybe you're interested to contribute ? I think that my lib is a bit too complex and gets intimidating compared to the LOC of Camping. Let me know if you want to be introduced a little bit :) -- Cheers, zimbatm http://zimbatm.oree.ch From zimba.tm at gmail.com Tue Nov 14 10:50:24 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Tue, 14 Nov 2006 16:50:24 +0100 Subject: [UHH] any blogs sprung from camping? In-Reply-To: <3db8a8970611132207l12e31758g623b87e1d46afbf6@mail.gmail.com> References: <3db8a8970611132207l12e31758g623b87e1d46afbf6@mail.gmail.com> Message-ID: <3ff63f9b0611140750s3908c11dl372b2421aa3c2c2f@mail.gmail.com> The problem with authentication is that you manage it at an application level. So if you're running each of them side by side, you'll have multiple User tables, etc... What I actually do is manage the authentication on the reverse proxy but it introduces other limitations, like the inhability to map datas with users in a straight forward manner. I think the best would be to provide some camping server-wide authentication mechanism so that it can be shared by the various applications. A server-wide template would also be interesting so that you can add links between the apps. But Camping doesn't support plugins (yet) :) -- Cheers, zimbatm http://zimbatm.oree.ch From mark.m.fredrickson at gmail.com Tue Nov 14 11:16:09 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Tue, 14 Nov 2006 10:16:09 -0600 Subject: RESTful mixin, mixin repo? In-Reply-To: <479cf31b0611132341m6a60c4d4m9c76756d0800f0fb@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <479cf31b0611132341m6a60c4d4m9c76756d0800f0fb@mail.gmail.com> Message-ID: <3db8a8970611140816j3b8f5331gc93097492728030@mail.gmail.com> I'd be happy to include this on the wiki. Can some explain how to add a helper function into the including module's namespace? eg. How do I get module Camping module REST module Helpers def form ... end end end end properly mixed in (so as to provide a form helper to override markaby) using 'include Camping::REST' Thanks, -M On 11/14/06, Rodney Ramdas wrote: > hey, that's nice > > perhaps you could write up a page on the wiki ? > > http://code.whytheluckystiff.net/camping/wiki/LikeRails > > > > On 11/14/06, Mark Fredrickson wrote: > > Hi, > > > > I just put together a little mixin to provide pseudo-RESTful services > > in camping apps. Basically, it looks for a hidden _verb field in form > > posts, and sets the @method to the supplied value (e.g. put or delete > > - which browsers don't support). This lets you define put and delete > > methods in your controllers. Groovy. > > > > Code: > > > > http://pastie.caboo.se/22613 > > > > Is there any permanent repo of little code snippets/mini-libraries for > > Camping? Is the wiki the best place? I think a lot of camping code > > could be re-used via mixins and it would be nice to have a > > Camping-forge type place to go find existing work. > > > > Cheers, > > -Mark > > _______________________________________________ > > Camping-list mailing list > > Camping-list at rubyforge.org > > http://rubyforge.org/mailman/listinfo/camping-list > > > > > -- > Rodney > http://www.pinupgeek.com > http://www.dutchrailers.org > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > From mark.m.fredrickson at gmail.com Tue Nov 14 11:36:37 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Tue, 14 Nov 2006 10:36:37 -0600 Subject: [UHH] any blogs sprung from camping? In-Reply-To: <3ff63f9b0611140750s3908c11dl372b2421aa3c2c2f@mail.gmail.com> References: <3db8a8970611132207l12e31758g623b87e1d46afbf6@mail.gmail.com> <3ff63f9b0611140750s3908c11dl372b2421aa3c2c2f@mail.gmail.com> Message-ID: <3db8a8970611140836l3dde5c91m902d0cd2129fea2b@mail.gmail.com> Perhaps I'm way in the wrong, but I assumed we could mixin additional Models, Views, and Controllers. I just sent another message to the list, where I realized that this is not as easy as I thought. Is it possible at all? If so, I think this would provide a very good avenue for a unified authentication/user method. We could mixin a User model, a Login controller, and the appropriate views. Like the Camping::Session mixin. Similarly for your site wide template idea, mixin a layout method. Again, I'm still pretty new to camping, so I might be misunderstanding the whole thing. Cheers, -M On 11/14/06, Jonas Pfenniger wrote: > The problem with authentication is that you manage it at an > application level. So if you're running each of them side by side, > you'll have multiple User tables, etc... What I actually do is manage > the authentication on the reverse proxy but it introduces other > limitations, like the inhability to map datas with users in a straight > forward manner. > > I think the best would be to provide some camping server-wide > authentication mechanism so that it can be shared by the various > applications. A server-wide template would also be interesting so that > you can add links between the apps. But Camping doesn't support > plugins (yet) :) > > -- > Cheers, > zimbatm > > http://zimbatm.oree.ch > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > From aggregat4+camping at gmail.com Tue Nov 14 15:42:28 2006 From: aggregat4+camping at gmail.com (Boris Terzic) Date: Tue, 14 Nov 2006 21:42:28 +0100 Subject: Catching a list of variables with a Controller Message-ID: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> Hi All, I have been learning some ruby and some Camping at the same time by implementing a little webapp to track expenses (one man's blog...) that includes the ability to tag entries with 1 or more tags. I wanted to offer the possibility to narrow the view of expenses by adding tags to a filter (this works) and I also wanted this filter to be reflected in the URL. Like so: normal URL: http://localhost:3301/ filtered URL: http://localhost:3301/filter/tag1/tag2/tag3 However, I can't get this to work since I require a variable number of regexp groups (like say an array) and I could not find a routing syntax that would allow this (something like class Filter < R '/filter/(\w/)*' ). I currently use a route which looks like: class Filter < R '/filter', '/filter/(.+)' And I represent the N tags as a string where tags are comma-separated. It works but purty, it isn't. Suggestions? Or am I bonkers? Thanks. -- Boris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20061114/2046eba9/attachment.html From chris at ozmm.org Tue Nov 14 17:32:22 2006 From: chris at ozmm.org (Chris Wanstrath) Date: Tue, 14 Nov 2006 14:32:22 -0800 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> Message-ID: On Nov 13, 2006, at 10:37 PM, Mark Fredrickson wrote: > I just put together a little mixin to provide pseudo-RESTful services > in camping apps. Basically, it looks for a hidden _verb field in form > posts, and sets the @method to the supplied value (e.g. put or delete > - which browsers don't support). This lets you define put and delete > methods in your controllers. Groovy. That's rad. While we're on the topic, I rolled a Railsish respond_to method for my Camping app: http://pastie.caboo.se/22733 -- Chris Wanstrath http://errtheblog.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20061114/fc8aaaf3/attachment.html From roland.crosby at students.olin.edu Tue Nov 14 21:51:34 2006 From: roland.crosby at students.olin.edu (Roland Crosby) Date: Tue, 14 Nov 2006 21:51:34 -0500 Subject: Catching a list of variables with a Controller In-Reply-To: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> References: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> Message-ID: <3F98AA21-2B8D-458A-B9E7-880A4EF27D6C@students.olin.edu> This works for me: class Filter < R '/filter/([\w/]+)' def get tags @tags = tags.split('/') end end Then http://localhost:3301/filter/tag1/tag2/tag3 will make @tags into ['tag1', 'tag2', 'tag3']. I think this is what you want... Roland On Nov 14, 2006, at 3:42 PM, Boris Terzic wrote: > Hi All, > > I have been learning some ruby and some Camping at the same time by > implementing a little webapp to track expenses (one man's blog...) > that includes the ability to tag entries with 1 or more tags. > > I wanted to offer the possibility to narrow the view of expenses by > adding tags to a filter (this works) and I also wanted this filter > to be reflected in the URL. Like so: > > normal URL: http://localhost:3301/ > filtered URL: http://localhost:3301/filter/tag1/tag2/tag3 > > However, I can't get this to work since I require a variable number > of regexp groups (like say an array) and I could not find a routing > syntax that would allow this (something like class Filter < R '/ > filter/(\w/)*' ). > > I currently use a route which looks like: > > class Filter < R '/filter', '/filter/(.+)' > > And I represent the N tags as a string where tags are comma- > separated. It works but purty, it isn't. > > Suggestions? Or am I bonkers? > > Thanks. > > -- > Boris From manfred at gmail.com Wed Nov 15 03:07:01 2006 From: manfred at gmail.com (Manfred Stienstra) Date: Wed, 15 Nov 2006 09:07:01 +0100 Subject: Catching a list of variables with a Controller In-Reply-To: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> References: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> Message-ID: On Nov 14, 2006, at 9:42 PM, Boris Terzic wrote: > However, I can't get this to work since I require a variable number > of regexp groups (like say an array) and I could not find a routing > syntax that would allow this (something like class Filter < R '/ > filter/(\w/)*' ). Correct. > And I represent the N tags as a string where tags are comma- > separated. It works but purty, it isn't. > > Suggestions? Or am I bonkers? Well, you're obviously bonkers. Who in their right mind would ever start programming Ruby? AFAIK there is no way to represent an arbitrary number of arguments in a URL in camping, but if you stop to think what a URL is then it's not so strange. The most obvious place to put parts of a URL that don't point to a resource is the query string. < R '/expenses' /expenses?filter=tag1+tag2+tag3 Manfred From zimba.tm at gmail.com Wed Nov 15 03:29:26 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Wed, 15 Nov 2006 09:29:26 +0100 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611140816j3b8f5331gc93097492728030@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <479cf31b0611132341m6a60c4d4m9c76756d0800f0fb@mail.gmail.com> <3db8a8970611140816j3b8f5331gc93097492728030@mail.gmail.com> Message-ID: <3ff63f9b0611150029o75af4afflcfb138caf33bba12@mail.gmail.com> On 14/11/06, Mark Fredrickson wrote: > I'd be happy to include this on the wiki. Can some explain how to add > a helper function into the including module's namespace? > > eg. How do I get > > module Camping > module REST > module Helpers > def form ... > end > end > end > end > > properly mixed in (so as to provide a form helper to override markaby) > using 'include Camping::REST' You'll have to use the included callback. like : module REST def self.included(app) app::Helpers.send :include, Helpers end end -- Cheers, zimbatm http://zimbatm.oree.ch From zimba.tm at gmail.com Wed Nov 15 03:40:36 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Wed, 15 Nov 2006 09:40:36 +0100 Subject: [UHH] any blogs sprung from camping? In-Reply-To: <3db8a8970611140836l3dde5c91m902d0cd2129fea2b@mail.gmail.com> References: <3db8a8970611132207l12e31758g623b87e1d46afbf6@mail.gmail.com> <3ff63f9b0611140750s3908c11dl372b2421aa3c2c2f@mail.gmail.com> <3db8a8970611140836l3dde5c91m902d0cd2129fea2b@mail.gmail.com> Message-ID: <3ff63f9b0611150040r4b52c58ehfe6ff3d47b9cfee5@mail.gmail.com> Yes, look in Equipment so see what I did. There is a security module that separate the authentication of the authorization. You can define authentication or authorization rules on a class or application wide level. Note that mixins have some limitations, this is why the Equipment extension method is pretty complex. If you mix module A in module B and THEN add some methods to module A, module B won't get them. In Equipment, all includes are done when the #create method is called to avoid that problem. -- Cheers, zimbatm [1] http://zimbatm.oree.ch/files/camping.png From zimba.tm at gmail.com Wed Nov 15 04:58:34 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Wed, 15 Nov 2006 10:58:34 +0100 Subject: Catching a list of variables with a Controller In-Reply-To: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> References: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> Message-ID: <3ff63f9b0611150158w7ff9fda9tee3c91ee8b05ca27@mail.gmail.com> Hi Boris, welcome to Ruby and Camping :) Camping doesn't support nested regexp groups like ((\w+)\/) so you'll have to do it differently. Your second approach is right. You can also use the multiple arguments input if you don't want to split the string with the commas. Like ?tag=one&tag=two&tag=three. That will give you a ['one', 'two', 'three'] array in input.tag. -- Cheers, zimbatm http://zimbatm.oree.ch From mark.m.fredrickson at gmail.com Thu Nov 16 11:00:29 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Thu, 16 Nov 2006 10:00:29 -0600 Subject: RESTful mixin, mixin repo? In-Reply-To: <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> Message-ID: <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> Hi Jonas, Thanks for this reply, and the other cluing me into the .included callback. I'll take a look at that later today and see if I can get it to work. > Great ! I wanted to implement that for long time and never had it (the > time). I've packages a set of Camping extensions in a package called > "Equipment". Apparently I don't have many followers but maybe you're > interested to contribute ? > > I think that my lib is a bit too complex and gets intimidating > compared to the LOC of Camping. Let me know if you want to be > introduced a little bit :) Regarding equipment, you're right: it is a little intimidating. I opened it up and thought "hey, what are all these "depends" calls? why can't I just use 'include Foo'?". I am willing to believe these are necessary, but I am worried that it raises the bar for new programmers (e.g. me) who aren't willing to take the time to make their little code snippets (like the two posted in this thread) into full equipment compatible modules. I'd like a solution where I can define something like: module MyModule module Models ... end module Controllers ... end module Views ... end module Helpers ... end end and have anyone else come along and just drop it into their apps with one line of code (or perhaps two, if something needs to be run in the create method). eg MagicModuleIncluder.make_magic :MyModule, :SomeOtherModule, ... def MyApp.create MyModule.create SomeOtherModule.create ... MyApp creation code ... end My inspiration for this is the Camping::Sessions code. It's not very complicated itself, and it drops right into any other camping app. I've been thinking about starting a little website where people can upload "songs." Little camping components that don't require a lot of work to create or include in other apps. (The reason behind the word song is that when one goes camping, you're likely to have a sing-a-long. Apps can join in or not if they want. Cheesy? Yes.) A place where developers can share their code without having to meet a lot of dependency requirements or create a gem, or otherwise put themselves out. Think pastie + tepee. WIth RSS. Lots of RSS. I'll make a formal announcement when I have something more than vapor, but if anyone is interested in helping, I think there are two things that need to happen: 1. CampSongs (the module/class) that has the necessary vodoo to make the code I posted above possible. 2. CampSon.gs (the website) the camping app that makes the sharing of songs easy and effective. It should probably eat a healthy amount of dog food and use as many songs as possible. Email me off-list if you're interested, and I'll keep you posted. And with that, I shall go make code of this vapor, -Mark From michael.daines at gmail.com Thu Nov 16 19:43:07 2006 From: michael.daines at gmail.com (Michael Daines) Date: Thu, 16 Nov 2006 16:43:07 -0800 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> Message-ID: > MagicModuleIncluder.make_magic :MyModule, :SomeOtherModule, ... > > def MyApp.create > MyModule.create > SomeOtherModule.create > ... MyApp creation code ... > end I'm not sure I quite understand this... what does MagicModuleIncluder do that simply including modules doesn't? (As in: http:// code.whytheluckystiff.net/camping/wiki/BeforeAndAfterOverrides) What sort of stuff do you have in mind for these components? But to add some more mixin stuff to the stew, here's a one you can use to send JSON in the body of a request and have it parsed for you into the @input: http://mdaines.com/svn/messages/trunk/lib/json_input.rb Also an authentication mixin (without proper credit to its original author but this repository is an unreleased project and I'll put it back in soon) which you can use inside controllers: http://mdaines.com/svn/messages/trunk/lib/authentication.rb You might also have a look at the fake_method one which does the same thing as the code posted earlier in this thread. -- Michael Daines From zimba.tm at gmail.com Fri Nov 17 03:13:13 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Fri, 17 Nov 2006 09:13:13 +0100 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> Message-ID: <3ff63f9b0611170013j5af6e372kdf2ab9e6927bfba9@mail.gmail.com> This is what I though. Equipment seems pretty complicated but it is not really. What's complicated is the extension mechanism that was created to support many use cases. If you overlook that, the rest is pretty simple. Basically, to create a Camping equipment, you do the following : module YourExtension extend Equipment # installs the hooks depends_on OtherExtension # make sure the other extension is included first # Here you mimic your app's structure. class methods are defined with a module # called like your constant + ClassMethods. Like ControllersClassMethods. module Controllers # controllers will get copied over to your app class Woot # R is not available end end module Helpers # new helper def hello end end module CClassMethods # class methods for your app def create # the create method is chained super # do something end end end in your app : require 'equipment' Camping.goes :YourApp module YourApp equip YourExtension end Maybe I should put that more in form an make a tutorial. -- Cheers, zimbatm http://zimbatm.oree.ch From boss at topfunky.com Sat Nov 18 07:42:16 2006 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Sat, 18 Nov 2006 23:42:16 +1100 Subject: Camping S5 Presenter App Message-ID: <84CCE13F-001E-4756-BCD6-F42F44E43B40@topfunky.com> I attended a lecture in Sydney, Australia earlier this week that featured a rulin' presenter app written in Camping. It recreates Eric Myer's S5 presenter app, but with a better implementation in Ruby. I hope I'm not jumping the gun, but the author is Myles Byrne and he posted a link to the svn here (don't bug him with feature requests for a few weeks...he's still working on it): http://svn.ducknewmedia.com.au/public/presenter/ Geoff ...................................... Blog | http://nubyonrails.com Podcast | http://podcast.rubyonrails.org Workshops | http://rubyonrailsworkshops.com Screencasts | http://peepcode.com From mark.m.fredrickson at gmail.com Sun Nov 19 19:34:35 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Sun, 19 Nov 2006 18:34:35 -0600 Subject: RESTful mixin, mixin repo? In-Reply-To: References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> Message-ID: <3db8a8970611191634r34e06631w2319eb582d6e77c1@mail.gmail.com> > I'm not sure I quite understand this... what does MagicModuleIncluder > do that simply including modules doesn't? (As in: http:// > code.whytheluckystiff.net/camping/wiki/BeforeAndAfterOverrides) What > sort of stuff do you have in mind for these components? So, I haven't entirely got to the bottom of this yet, but let's at some examples of include not working as I want. (As to what I want: entire MVC stacks that I can drop into different apps - eg. a user login engine that works in any app a /user and provides some useful predicates - is_logged_in?, etc...) So, I've created a little app that holds "Things." Nothing more than a title. Super simple. Now that I have my thing engine working, I want to incorporate it into another app. I comment out some stuff that would seem to conflict (eg. the layout view, the Index controller, Camping.goes :SimpleApp). You can see it here: http://pastie.caboo.se/23577 Seems straight forward, yes? Now let's include it in another app. We take a direct approach and include each part of the MVC stack in the appropriate part of our app. See the "Simpler" app here: http://pastie.caboo.se/23578 Try to run it. No luck: [mark 18:14:11 app]$ camping simple_app.rb !! trouble loading simpleapp: [NameError] uninitialized constant Base /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/i386/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing' /Users/mark/Documents/Programming/Ruby/campingtest/app/simple_app.rb:13 Hmm. Strange. While I don't think it's a good idea, let's try to uncomment the Camping.goes :SimpleApp line in our included MVC. Try to launch. Success (or so we think). The index page works. It's all good, right? Let's try to look at our "things"http://localhost:3301/thing Camping Problem! SimpleApp::Controllers::Thing.GET NoMethodError no such method `list_thing': ... Uh oh. Something's borked. I haven't figured out how to solve this problem, but I'm sure it's solvable. But you can see the problem. Looking at the camping code itself, it clearly does some unusual stuff to add apps to the mix. Like eval'ing a gsub version of the camping file itself. That kind of stuff is wild, but it makes it hard to anticipate exactly how to hook into the system. As Jonas's emails on the subject indicate, Equipment has been wrestling with this problem. I'm going to keep hacking on this. Perhaps I'll have a better solution soon. Also - feel free to point out why I'm an idiot. :-) -Mark From zimba.tm at gmail.com Mon Nov 20 02:46:24 2006 From: zimba.tm at gmail.com (Jonas Pfenniger) Date: Mon, 20 Nov 2006 08:46:24 +0100 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611191634r34e06631w2319eb582d6e77c1@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> <3db8a8970611191634r34e06631w2319eb582d6e77c1@mail.gmail.com> Message-ID: <3ff63f9b0611192346i5b9b6e73pe93618f34a0fa3f6@mail.gmail.com> @Mark Fredrickson : This is exactly the problems that Equipment solves. Add "extend Equipment" in the SimpleApp module and "equip SimpleApp" in Simpler. You'll also have to remove the models and the routes in SimpleApp since I didn't implement the class methods and Base. If you want to do it on your own you'll have to solve the following problem : include ModuleA in ModuleB. Then add some methods to ModuleA or include another module into it. Then look in ModuleB.instance_methods. Your new ModuleA methods should not be there. -- Cheers, zimbatm http://zimbatm.oree.ch From a-ml-camping at harper.nu Mon Nov 20 11:25:52 2006 From: a-ml-camping at harper.nu (Adam Harper) Date: Mon, 20 Nov 2006 16:25:52 +0000 Subject: RESTful mixin, mixin repo? In-Reply-To: <3db8a8970611191634r34e06631w2319eb582d6e77c1@mail.gmail.com> References: <3db8a8970611132237m77c0244axe77f27066b78923a@mail.gmail.com> <3ff63f9b0611140740i507e70a7i59bf4563eb5259c0@mail.gmail.com> <3db8a8970611160800v5ccea52ci9719104cea11cd51@mail.gmail.com> <3db8a8970611191634r34e06631w2319eb582d6e77c1@mail.gmail.com> Message-ID: <4561D710.8090207@harper.nu> Mark Fredrickson wrote: > [...] I want: entire MVC stacks that I can drop into different apps - > eg. a user login engine that works in any app a /user and provides > some useful predicates - is_logged_in?, etc...) I've had a look at this and think I've found something like a solution. The Controllers and Models don't seem to be much of an issue, the Views are a little more problematic. Read on for the details. # Views Camping.goes :NewApp module NewApp module Views; include OtherApp::Views; end end Doesn't work because NewApp::Views is included into NewApp::Mab *before* the inclusion of OtherApp::Views. As a result the OtherApp::Views methods are *not* included in the NewApp::Mab class and so are not available for controllers/other view methods to call. At least I *think* that's what's happening. Camping.goes :NewApp module NewApp class Mab; include OtherApp::Views; end end Works, but you can't override OtherApp's views in NewApp. If OtherApp includes a layout then you're stuck with it (unless you change it under the Mab class in NewApp rather than Views). # Create the NewApp module and include the OtherApp's Views into it module NewApp module Views; include OtherApp::Views; end end # Stir in Camping goodness Camping.goes :NewApp # Write the NewApp, freely using the views from OtherApp module NewApp # ... models, views, controllers, etc. end Works, and is somewhat less coupled to Camping's implementation. A benefit of this is that you can override any of OtherApp's views in NewApp (e.g. overriding the layout) without leaving the cosy confines of the Views module. # Controllers Camping.goes :NewApp module NewApp module Controllers; include OtherApp::Controllers; end end Works. Doing the include before Camping.goes, as in Views above, also works. # Models Camping.goes :NewApp module NewApp module Models; include OtherApp::Models; end include OtherApp # for the create method end Doesn't work -- the OtherApp.create singleton method isn't included into NewApp (due to the way include works). Camping.goes :NewApp module NewApp module Models; include OtherApp::Models; end def self.create Models.create_schema end end Doesn't work, the OtherApp tables don't get created. create_schema doesn't see the schema from OtherApp for some reason. Camping.goes :NewApp module NewApp module Models; include OtherApp::Models; end def self.create OtherApp::Models.create_schema end end Works. Tables are created and models from OtherApp can be used in NewApp. Doing the include, and defining self.create, before Camping.goes, as in Views above, also works. # Putting it all together See the attached: campers.rb and campfire.rb. campers.rb is a simple app that exposes a list of campers, campfire.rb extends this with another controller and view, please excuse the campness of it all. The main ingredient is the means by which Campfire includes Campers: module Campfire module Models; include Campers::Models; end module Controllers; include Campers::Controllers; end module Views; include Campers::Views; end module Helpers; include Campers::Helpers; end def self.create; Campers.create; end end This comes *before* the `Camping.goes :Campfire` line. So, if you want to incorporate one Camping app within another the above method seems to be the way to go. Seems a bit verbose though and I don't like that whole "you have to extend the new application before creating it with Camping.goes" thing. How about coercing include to help us out a bit? module Campers def self.included(other_app) %w{Helpers Models Controllers Views}.each do |mod| next unless self.const_defined? mod unless other_app.const_defined? mod other_app.const_set(mod, Module.new) end our_mod = self.const_get(mod) other_app.const_get(mod).class_eval(){include our_mod} end if !other_app.method_defined?('create') \ && self.method_defined?('create') other_app.class_eval( "def self.create; #{self.name}.create; end" ) end end end Hmmm. That's decidedly *more* verbose. But we can now do this: module Campfire; include Campers; end Camping.goes :Campfire # ... Campfire models, views, controllers, etc. So, if we can hide that great big chunk of `included` somewhere out of sight, but where Camping apps can pick it up, we'd be somewhere near to where we want to be. -- Adam -------------- next part -------------- A non-text attachment was scrubbed... Name: campers.rb Type: application/x-ruby Size: 1340 bytes Desc: not available Url : http://rubyforge.org/pipermail/camping-list/attachments/20061120/995d29c5/attachment-0002.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: campfire.rb Type: application/x-ruby Size: 834 bytes Desc: not available Url : http://rubyforge.org/pipermail/camping-list/attachments/20061120/995d29c5/attachment-0003.bin From aggregat4+camping at gmail.com Mon Nov 20 18:04:02 2006 From: aggregat4+camping at gmail.com (Boris Terzic) Date: Tue, 21 Nov 2006 00:04:02 +0100 Subject: Catching a list of variables with a Controller In-Reply-To: <3ff63f9b0611150158w7ff9fda9tee3c91ee8b05ca27@mail.gmail.com> References: <132a91ff0611141242w16228bbk805da27a71b54fcb@mail.gmail.com> <3ff63f9b0611150158w7ff9fda9tee3c91ee8b05ca27@mail.gmail.com> Message-ID: <132a91ff0611201504x3647b2cejde90cd823c933566@mail.gmail.com> First off thanks for all the great responses! And now some individual comments. @Manfred: Roland's solution does seems to allow this approach, and while it is not entirely "clean" it's no worse than my comma-separated-directory approach. As for these sorts of queries not representing resources and perhaps belonging into a query string? I don't know, I get your point but then again "expenses/filter/tag1/tag2/tag3" does represent the resource that is the collection of all expenses that have those tags. Maybe. This is where you need to get Sam Ruby involved for a restful knock on the head. @Roland: cool, I will adopt it as long as I don't get head-bashed by Sam. @Jonas: thanks for the welcome, and yet another approach! Interesting feature with the array parameter. Camping rocks. (yes, I am a fanboy) Cheers, Boris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20061121/7bcf8452/attachment.html From paul at luon.net Sat Nov 25 05:02:15 2006 From: paul at luon.net (Paul van Tilburg) Date: Sat, 25 Nov 2006 11:02:15 +0100 Subject: Newline problem Message-ID: <20061125100215.GH4329@power.luon.net> Hello all, Recently I have started writing some small package apps. The main app I'm working on at the moment is Camping/Photos[1]. Here I use a controller to serve static files (Theme[3]) that I have copied from [2]. There seems a problem however, when using this via lighttpd. All files that get served (via photos-dispatch.rb) get an extra '\r\n' in front. This means that PNG and JPEG files break. I tried serving an empty file (0B) and got served a file of 2 bytes containing '\r\n'. Since I use the X-Sendfile header I kind of assumed it is in the hands of lighttp. However, I have had this working and the only things I have changed are in the app and not in lighttpd, maybe there are some subtleties I am missing. Can anyone help me finding the bug? Kind regards, Paul 1: https://trac.luon.net/camping-photos/ 2: http://code.whytheluckystiff.net/camping/wiki/ServingStaticFiles 3: https://trac.luon.net/camping-photos/file/trunk/photos/controllers.rb -- Student @ Eindhoven | email: paul at luon.net University of Technology, The Netherlands | JID: paul at luon.net >>> Using the Power of Debian GNU/Linux <<< | GnuPG key ID: 0x50064181 From manfred at gmail.com Sat Nov 25 08:01:55 2006 From: manfred at gmail.com (Manfred Stienstra) Date: Sat, 25 Nov 2006 14:01:55 +0100 Subject: Newline problem In-Reply-To: <20061125100215.GH4329@power.luon.net> References: <20061125100215.GH4329@power.luon.net> Message-ID: <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> I think this problem was solved just after Camping 1.5 was released. Please try the following: gem install camping --source code.whytheluckystiff.net and see if that fixes it. Manfred From paul at luon.net Sat Nov 25 12:15:27 2006 From: paul at luon.net (Paul van Tilburg) Date: Sat, 25 Nov 2006 18:15:27 +0100 Subject: Newline problem In-Reply-To: <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> References: <20061125100215.GH4329@power.luon.net> <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> Message-ID: <20061125171527.GI4329@power.luon.net> On Sat, Nov 25, 2006 at 02:01:55PM +0100, Manfred Stienstra wrote: > I think this problem was solved just after Camping 1.5 was released. > Please try the following: > > gem install camping --source code.whytheluckystiff.net Yes, I was running 1.5. This seems to have been fixed in 171. I still think it's strange since the body should be discarded when an X-Sendfile header is present.. somehow the newline survived? Thanks! Paul -- Student @ Eindhoven | email: paul at luon.net University of Technology, The Netherlands | JID: paul at luon.net >>> Using the Power of Debian GNU/Linux <<< | GnuPG key ID: 0x50064181 From why at whytheluckystiff.net Sun Nov 26 18:43:49 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Sun, 26 Nov 2006 17:43:49 -0600 Subject: Camping 1.6 (was Re: Newline problem) In-Reply-To: <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> References: <20061125100215.GH4329@power.luon.net> <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> Message-ID: <20061126234348.GA37234@beekeeper.hobix.com> On Sat, Nov 25, 2006 at 02:01:55PM +0100, Manfred Stienstra wrote: > I think this problem was solved just after Camping 1.5 was released. That's true, this little problem bothered me a lot and maybe it's time for 1.6. Our milestones: are loading apps straight from a Gem and daemon mode[1]. Anything else? _why [1] http://code.whytheluckystiff.net/camping/roadmap From mark.m.fredrickson at gmail.com Mon Nov 27 09:20:00 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Mon, 27 Nov 2006 08:20:00 -0600 Subject: Camping 1.6 (was Re: Newline problem) In-Reply-To: <20061126234348.GA37234@beekeeper.hobix.com> References: <20061125100215.GH4329@power.luon.net> <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> <20061126234348.GA37234@beekeeper.hobix.com> Message-ID: <3db8a8970611270620h70a5166dn8553b795d48ea14e@mail.gmail.com> I'd like to see the logic in the camping server wrapped into a class. This would allow other uses. Right now, there is no easy way to pass in database, url, and port parameters. It would be helpful to have an API like: require 'camping/server' db = { 'host' => 'localhost, 'username' => 'camping', 'password' => 'foo', 'db' => 'mysql_camping', .... } myserver = Camping::Server.new('localhost', 3301, db) myserver.run # boots the server and returns when the sever dies I wrote a rake task to launch camping apps using a Rails config file, and I had to duplicate virtually all the code in the camping server. I'm happy to write this patch, but I won't have time until later this week. What's the timeline for 1.6? -M On 11/26/06, why the lucky stiff wrote: > On Sat, Nov 25, 2006 at 02:01:55PM +0100, Manfred Stienstra wrote: > > I think this problem was solved just after Camping 1.5 was released. > > That's true, this little problem bothered me a lot and maybe it's time for 1.6. > Our milestones: are loading apps straight from a Gem and daemon mode[1]. > > Anything else? > > _why > > [1] http://code.whytheluckystiff.net/camping/roadmap > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > From why at whytheluckystiff.net Mon Nov 27 12:54:51 2006 From: why at whytheluckystiff.net (why the lucky stiff) Date: Mon, 27 Nov 2006 11:54:51 -0600 Subject: Camping 1.6 (was Re: Newline problem) In-Reply-To: <3db8a8970611270620h70a5166dn8553b795d48ea14e@mail.gmail.com> References: <20061125100215.GH4329@power.luon.net> <9B7BEE56-BE79-46EC-9732-C3278E5BF5B7@gmail.com> <20061126234348.GA37234@beekeeper.hobix.com> <3db8a8970611270620h70a5166dn8553b795d48ea14e@mail.gmail.com> Message-ID: <20061127175451.GB68515@beekeeper.hobix.com> On Mon, Nov 27, 2006 at 08:20:00AM -0600, Mark Fredrickson wrote: > I'd like to see the logic in the camping server wrapped into a class. > This would allow other uses. Right now, there is no easy way to pass > in database, url, and port parameters. It would be helpful to have an > API like: > > require 'camping/server' > > db = { 'host' => 'localhost, 'username' => 'camping', 'password' => > 'foo', 'db' => 'mysql_camping', .... } > myserver = Camping::Server.new('localhost', 3301, db) > myserver.run # boots the server and returns when the sever dies That's a brilliant idea. Thankyou and there's no rush, just: whenever. _why From paul at luon.net Tue Nov 28 12:28:36 2006 From: paul at luon.net (Paul van Tilburg) Date: Tue, 28 Nov 2006 18:28:36 +0100 Subject: R() in controllers Message-ID: <20061128172835.GD9117@power.luon.net> Hello all, I have an app mounted under /test via lighttpd fastcgi as indicated on [1]. Here I use R(Foo, bar) in views to link to controller foo, this correctly creates a /test/foo/bar link. However, when I use R() in some controller, for example: headers['Refresh'] = "60; url=#{R(Foo, bar)}" The generated link is /foo/bar, which obviously links to something non-existant. Can somebody affirm that R() in controllers do not work correctly? Regards, Paul -- Student @ Eindhoven | email: paul at luon.net University of Technology, The Netherlands | JID: paul at luon.net >>> Using the Power of Debian GNU/Linux <<< | GnuPG key ID: 0x50064181 From mark.m.fredrickson at gmail.com Tue Nov 28 23:06:07 2006 From: mark.m.fredrickson at gmail.com (Mark Fredrickson) Date: Tue, 28 Nov 2006 22:06:07 -0600 Subject: [ANN] Camping_generator Message-ID: <3db8a8970611282006s7b885e8qbd2a13e45a66a3a1@mail.gmail.com> Hello campers, I wanted to let you know that I've just released my camping generator, which uses the rails generator system to create new camping apps. $ gem install camping_generator It's the first part of my Parasite project, which aims to leverage rails for better, faster, stronger camping development. Feel free to take issue with my coding style, but submit issues at http://rubyforge.org/projects/parasite/ and I'll be happy to improve it. I should be releasing the the rest of the current Parasite system (so far, just a rake script to launch camping using Rails environments) later this week. Cheers, -Mark From a-ml-camping at harper.nu Wed Nov 29 05:00:52 2006 From: a-ml-camping at harper.nu (Adam Harper) Date: Wed, 29 Nov 2006 10:00:52 +0000 Subject: R() in controllers In-Reply-To: <20061128172835.GD9117@power.luon.net> References: <20061128172835.GD9117@power.luon.net> Message-ID: <456D5A54.8020006@harper.nu> Paul van Tilburg wrote: > Here I use R(Foo, bar) in views to link to controller foo, this correctly > creates a /test/foo/bar link. However, when I use R() in some controller, > for example: > > headers['Refresh'] = "60; url=#{R(Foo, bar)}" > > The generated link is /foo/bar, which obviously links to something > non-existant. Can somebody affirm that R() in controllers do not > work correctly? I don't think it's working incorrectly -- just a little unintuitively. In short, R() only prepends the app root (i.e. '/test') to the generated URL when called from within a View -- not Controllers. This can be worked around by using the "slash method"[1]: self / R(Foo, Bar) #=> '/test/foo/bar' See the Camping docs for the R() helper method[2], and the "Using R in the View" section in particular, for a fuller explanation. -- Adam [1] http://camping.rubyforge.org/classes/Camping/Helpers.html#M000016 [2] http://camping.rubyforge.org/classes/Camping/Helpers.html#M000014 From paul at luon.net Wed Nov 29 08:52:19 2006 From: paul at luon.net (Paul van Tilburg) Date: Wed, 29 Nov 2006 14:52:19 +0100 Subject: R() in controllers In-Reply-To: <456D5A54.8020006@harper.nu> References: <20061128172835.GD9117@power.luon.net> <456D5A54.8020006@harper.nu> Message-ID: <20061129135219.GA15279@power.luon.net> On Wed, Nov 29, 2006 at 10:00:52AM +0000, Adam Harper wrote: > Paul van Tilburg wrote: > > Here I use R(Foo, bar) in views to link to controller foo, this correctly > > creates a /test/foo/bar link. However, when I use R() in some controller, > > for example: > > > > headers['Refresh'] = "60; url=#{R(Foo, bar)}" > > > > The generated link is /foo/bar, which obviously links to something > > non-existant. Can somebody affirm that R() in controllers do not > > work correctly? > > I don't think it's working incorrectly -- just a little unintuitively. > In short, R() only prepends the app root (i.e. '/test') to the > generated URL when called from within a View -- not Controllers. Yes, I see what you mean. Thanks for pointing that out. Indeed, you assume it is going to behave the same. Kind regards, Paul -- Student @ Eindhoven | email: paul at luon.net University of Technology, The Netherlands | JID: paul at luon.net >>> Using the Power of Debian GNU/Linux <<< | GnuPG key ID: 0x50064181