From kevwil at gmail.com Thu Nov 1 14:21:30 2007 From: kevwil at gmail.com (Kevin Williams) Date: Thu, 1 Nov 2007 12:21:30 -0600 Subject: Mongrel breaking Merb? In-Reply-To: References: <683a886f0710310754m34407e6dp527d403bb692404d@mail.gmail.com> Message-ID: <683a886f0711011121k2f601602sd96afdd7dd7eec1d@mail.gmail.com> I just updated everything this morning, and still get the error. Here's the message. I'm now on Leopard using the Apple build of Ruby. I have mongrel 1.0.4 and swiftiply 0.6.1 installed. I don't think there are any other gems that would be involved here. /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:139:in `initialize': wrong number of arguments (5 for 4) (ArgumentError) from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:139:in `new' from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:139:in `listener' from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:518:in `cloaker_' from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:50:in `call' from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:50:in `initialize' from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:517:in `new' from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:517:in `mongrel_start' from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:446:in `run' from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 from /usr/bin/merb:16:in `load' from /usr/bin/merb:16 Thanks for looking into it. :) On 10/31/07, Wayne E. Seguin wrote: > On 10/31/07, Kevin Williams wrote: > > Has anyone had troubles from Mongrel > 1.0.1? Just curious, because > > the last time I tried to run Merb it gave me some Mongrel error about > > the wrong number of arguments, or something like that. > > > > I can post the exact message tonight when I get home. > > > > Kevin, > > There have been a few changes so exact message would be most helpful. > > Thank you, > > ~Wayne -- Cheers, Kevin Williams http://kevwil.com/ http://www.almostserio.us/ http://kevwil.jaiku.com/ From ez at engineyard.com Thu Nov 1 21:56:17 2007 From: ez at engineyard.com (Ezra Zygmuntowicz) Date: Thu, 1 Nov 2007 18:56:17 -0700 Subject: Mongrel breaking Merb? In-Reply-To: <683a886f0711011121k2f601602sd96afdd7dd7eec1d@mail.gmail.com> References: <683a886f0710310754m34407e6dp527d403bb692404d@mail.gmail.com> <683a886f0711011121k2f601602sd96afdd7dd7eec1d@mail.gmail.com> Message-ID: <31564A68-60AB-4CCD-9BCA-34A7091B76EF@engineyard.com> This is a known probelm in swiftiply, the newest mongrel release takes 5 args for the constructor of a new http server but the evented_mongrel still uses 4. Kirk will be releasing an update sometime soon. Thanks -Ezra On Nov 1, 2007, at 11:21 AM, Kevin Williams wrote: > I just updated everything this morning, and still get the error. > Here's the message. > > I'm now on Leopard using the Apple build of Ruby. I have mongrel 1.0.4 > and swiftiply 0.6.1 installed. I don't think there are any other gems > that would be involved here. > > /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > configurator.rb:139:in > `initialize': wrong number of arguments (5 for 4) (ArgumentError) > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > configurator.rb:139:in > `new' > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > configurator.rb:139:in > `listener' > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:518:in > `cloaker_' > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > configurator.rb:50:in > `call' > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > configurator.rb:50:in > `initialize' > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb: > 517:in `new' > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:517:in > `mongrel_start' > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb: > 446:in `run' > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 > from /usr/bin/merb:16:in `load' > from /usr/bin/merb:16 > > Thanks for looking into it. :) > > > On 10/31/07, Wayne E. Seguin wrote: >> On 10/31/07, Kevin Williams wrote: >>> Has anyone had troubles from Mongrel > 1.0.1? Just curious, because >>> the last time I tried to run Merb it gave me some Mongrel error >>> about >>> the wrong number of arguments, or something like that. >>> >>> I can post the exact message tonight when I get home. >>> >> >> Kevin, >> >> There have been a few changes so exact message would be most helpful. >> >> Thank you, >> >> ~Wayne > > > -- > Cheers, > > Kevin Williams > http://kevwil.com/ > http://www.almostserio.us/ > http://kevwil.jaiku.com/ > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel Ezra Zygmuntowicz Founder & Ruby Hacker ezra at engineyard.com EngineYard.com From kevwil at gmail.com Thu Nov 1 22:00:16 2007 From: kevwil at gmail.com (Kevin Williams) Date: Thu, 1 Nov 2007 20:00:16 -0600 Subject: Mongrel breaking Merb? In-Reply-To: <31564A68-60AB-4CCD-9BCA-34A7091B76EF@engineyard.com> References: <683a886f0710310754m34407e6dp527d403bb692404d@mail.gmail.com> <683a886f0711011121k2f601602sd96afdd7dd7eec1d@mail.gmail.com> <31564A68-60AB-4CCD-9BCA-34A7091B76EF@engineyard.com> Message-ID: <683a886f0711011900x4ba78c7anb85530418b1a12a5@mail.gmail.com> Sweet. Thanks for the clarification! On 11/1/07, Ezra Zygmuntowicz wrote: > > This is a known probelm in swiftiply, the newest mongrel release > takes 5 args for the constructor of a new http server but the > evented_mongrel still uses 4. Kirk will be releasing an update > sometime soon. > > Thanks > -Ezra > > > On Nov 1, 2007, at 11:21 AM, Kevin Williams wrote: > > > I just updated everything this morning, and still get the error. > > Here's the message. > > > > I'm now on Leopard using the Apple build of Ruby. I have mongrel 1.0.4 > > and swiftiply 0.6.1 installed. I don't think there are any other gems > > that would be involved here. > > > > /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > > configurator.rb:139:in > > `initialize': wrong number of arguments (5 for 4) (ArgumentError) > > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > > configurator.rb:139:in > > `new' > > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > > configurator.rb:139:in > > `listener' > > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:518:in > > `cloaker_' > > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > > configurator.rb:50:in > > `call' > > from /Library/Ruby/Gems/1.8/gems/mongrel-1.0.4/lib/mongrel/ > > configurator.rb:50:in > > `initialize' > > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb: > > 517:in `new' > > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:517:in > > `mongrel_start' > > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb: > > 446:in `run' > > from /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 > > from /usr/bin/merb:16:in `load' > > from /usr/bin/merb:16 > > > > Thanks for looking into it. :) > > > > > > On 10/31/07, Wayne E. Seguin wrote: > >> On 10/31/07, Kevin Williams wrote: > >>> Has anyone had troubles from Mongrel > 1.0.1? Just curious, because > >>> the last time I tried to run Merb it gave me some Mongrel error > >>> about > >>> the wrong number of arguments, or something like that. > >>> > >>> I can post the exact message tonight when I get home. > >>> > >> > >> Kevin, > >> > >> There have been a few changes so exact message would be most helpful. > >> > >> Thank you, > >> > >> ~Wayne > > > > > > -- > > Cheers, > > > > Kevin Williams > > http://kevwil.com/ > > http://www.almostserio.us/ > > http://kevwil.jaiku.com/ > > _______________________________________________ > > Merb-devel mailing list > > Merb-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/merb-devel > > Ezra Zygmuntowicz > Founder & Ruby Hacker > ezra at engineyard.com > EngineYard.com > > > -- Cheers, Kevin Williams http://kevwil.com/ http://www.almostserio.us/ http://kevwil.jaiku.com/ From kevwil at gmail.com Fri Nov 2 08:19:00 2007 From: kevwil at gmail.com (Kevin Williams) Date: Fri, 2 Nov 2007 06:19:00 -0600 Subject: respond_to API In-Reply-To: <20071019054009.GA19544@uk.tiscali.com> References: <11409D88-BED6-48EC-8FF3-17217B5B55A4@gweezlebur.com> <683a886f0710161003h7aa903fch532e2e9f5de67253@mail.gmail.com> <2CD1E79E-D567-4770-935B-5A3FF6BC1613@gmail.com> <20071019054009.GA19544@uk.tiscali.com> Message-ID: <683a886f0711020519l50e5e159u720b56fc2b979335@mail.gmail.com> http://merb.devjavu.com/changeset/795 crossing_fingers.do ::Manually.refactor_controllers views.each {|v| mv "#{v.name}.#{v.extension}" "#{v.name}.#{v.format}.#{v.extension}"} end I got one controller refactored, and the html format didn't break yet, so we'll see how the :xml and :json formats go. On 10/18/07, Brian Candler wrote: > On Thu, Oct 18, 2007 at 02:11:24PM -0400, Stephen Caudill wrote: > > in the case of a rendered template, you do end up with a win though: > > > > class MyController > > provides :html > > def index > > provides :json, :yaml > > end > > end > > > > vs. > > > > class MyController > > def index > > respond_to do |format| > > format.html > > format.json > > format.yaml > > end > > end > > end > > But in that simple case, couldn't you just match the format to the template > extension automatically? > > That is, > > format.foo { ... } > > tells you how to render a foo request, but if not specified, it defaults to > render action.rfoo > > The 'provides' would be implied by the existence of the template with the > right extension. > > B. > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel > -- Cheers, Kevin Williams http://kevwil.com/ http://www.almostserio.us/ http://kevwil.jaiku.com/ From ivey at gweezlebur.com Fri Nov 2 08:43:51 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Fri, 2 Nov 2007 07:43:51 -0500 Subject: respond_to API In-Reply-To: <683a886f0711020519l50e5e159u720b56fc2b979335@mail.gmail.com> References: <11409D88-BED6-48EC-8FF3-17217B5B55A4@gweezlebur.com> <683a886f0710161003h7aa903fch532e2e9f5de67253@mail.gmail.com> <2CD1E79E-D567-4770-935B-5A3FF6BC1613@gmail.com> <20071019054009.GA19544@uk.tiscali.com> <683a886f0711020519l50e5e159u720b56fc2b979335@mail.gmail.com> Message-ID: On Nov 2, 2007, at 7:19 AM, Kevin Williams wrote: > http://merb.devjavu.com/changeset/795 > > crossing_fingers.do > ::Manually.refactor_controllers > views.each {|v| mv "#{v.name}.#{v.extension}" > "#{v.name}.#{v.format}.#{v.extension}"} > end > > I got one controller refactored, and the html format didn't break yet, > so we'll see how the :xml and :json formats go. For the record, I didn't *have* to drop the legacy template names, but Ez wanted me to get it in the same changeset so everything broke at once. HTML-only apps will probably not notice, other than the template rename. respond_to based apps will be a little harder, but really shouldn't be too tough. If anyone runs into trouble converting, hit me up on IRC, or on the Mailing List, or the Google Group, or in Charlotte Saturday...I'll be more than happy to help. From kevwil at gmail.com Fri Nov 2 10:33:01 2007 From: kevwil at gmail.com (Kevin Williams) Date: Fri, 2 Nov 2007 08:33:01 -0600 Subject: respond_to API In-Reply-To: References: <11409D88-BED6-48EC-8FF3-17217B5B55A4@gweezlebur.com> <683a886f0710161003h7aa903fch532e2e9f5de67253@mail.gmail.com> <2CD1E79E-D567-4770-935B-5A3FF6BC1613@gmail.com> <20071019054009.GA19544@uk.tiscali.com> <683a886f0711020519l50e5e159u720b56fc2b979335@mail.gmail.com> Message-ID: <683a886f0711020733x6c43d898j45fbb00342e6d73@mail.gmail.com> Everything seems smooth so far, but I've only got one (restful) controller so far. I do have about a dozen view files which needed renaming, but that wasn't too bad. I'm not complaining - this is life on the edge, things will break. I'm looking forward to the next release. On 11/2/07, Michael D. Ivey wrote: > On Nov 2, 2007, at 7:19 AM, Kevin Williams wrote: > > http://merb.devjavu.com/changeset/795 > > > > crossing_fingers.do > > ::Manually.refactor_controllers > > views.each {|v| mv "#{v.name}.#{v.extension}" > > "#{v.name}.#{v.format}.#{v.extension}"} > > end > > > > I got one controller refactored, and the html format didn't break yet, > > so we'll see how the :xml and :json formats go. > > For the record, I didn't *have* to drop the legacy template names, > but Ez wanted me to get it in the same changeset so everything broke > at once. > > HTML-only apps will probably not notice, other than the template rename. > > respond_to based apps will be a little harder, but really shouldn't > be too tough. > > If anyone runs into trouble converting, hit me up on IRC, or on the > Mailing List, or the Google Group, or in Charlotte Saturday...I'll be > more than happy to help. > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel > -- Cheers, Kevin Williams http://kevwil.com/ http://www.almostserio.us/ http://kevwil.jaiku.com/ From frazer.list at gmail.com Sat Nov 3 16:11:13 2007 From: frazer.list at gmail.com (frazer horn) Date: Sat, 3 Nov 2007 16:11:13 -0400 Subject: Render js Message-ID: Hi all Not sure if I'm missing something, render :js => "alert('hello');" does return the alert but also displays alert('hello') in the template as text. This is evident for all javascript returned via render js (inline or in .js.erb). Any help appreciated Thanks Frazer -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20071103/8f5bbc0a/attachment.html From kevwil at gmail.com Mon Nov 5 22:34:07 2007 From: kevwil at gmail.com (Kevin Williams) Date: Mon, 5 Nov 2007 20:34:07 -0700 Subject: what did I do? Message-ID: <683a886f0711051934r21f1ee79td55776accb4e41d5@mail.gmail.com> I'm following merb trunk. This morning I updated my gems, sync'd merb source and installed the merb gem from source. I don't know if I did something wrong, or if a new gem messed things up, or if there was a merb change which broke something. Now I get this error: Request: REQUEST_URI: / (2007-11-05 20:27:04) Params: {"action"=>"index", "controller"=>"articles"} Cookies: {"_session_id"=>"fe8eea1f497d002ee39ad61cbd868a2b"} Setting up session undefined method `keys' for # - (NoMethodError) /Users/kevwil/dev/git/rubyrubyroo/app/views/articles/index.html.haml:4 /Library/Ruby/Gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:1863:in `method_missing' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mixins/controller.rb:65:in `url' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/view_context.rb:73:in `send' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/view_context.rb:73:in `method_missing' (eval):11:in `_render_haml_1' (eval):8:in `each' (eval):8:in `_render_haml_1' /Library/Ruby/Gems/1.8/gems/haml-1.7.1/lib/haml/engine.rb:435:in `send' /Library/Ruby/Gems/1.8/gems/haml-1.7.1/lib/haml/engine.rb:435:in `compile' /Library/Ruby/Gems/1.8/gems/haml-1.7.1/lib/haml/engine.rb:186:in `to_html' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/template/haml.rb:44:in `transform' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mixins/render.rb:209:in `render' /Users/kevwil/dev/git/rubyrubyroo/app/controllers/articles.rb:10:in `index' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:57:in `send' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:57:in `call_action' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:32:in `dispatch' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/controller.rb:80:in `dispatch' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:53:in `dispatch_action' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:35:in `handle' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mongrel_handler.rb:86:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:155:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:282:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:557:in `cloaker_' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in `call' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in `initialize' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `new' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `mongrel_start' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:477:in `run' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 /usr/bin/merb:16:in `load' /usr/bin/merb:16 undefined method `each' for # - (NoMethodError) (erubis):144:in `dispatch_default_exception' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:95:in `dispatch_default_exception' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:77:in `dispatch_exception' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:39:in `handle' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mongrel_handler.rb:86:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:155:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:282:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:557:in `cloaker_' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in `call' /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in `initialize' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `new' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `mongrel_start' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:477:in `run' /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 /usr/bin/merb:16:in `load' /usr/bin/merb:16 Any suggestions? -- Cheers, Kevin Williams http://kevwil.com From frazer.list at gmail.com Wed Nov 7 07:22:38 2007 From: frazer.list at gmail.com (frazer horn) Date: Wed, 7 Nov 2007 07:22:38 -0500 Subject: merb 0.4.0 session issue Message-ID: Not sure if anyone else has had this problem. I was running on merb edge fine a few days ago. Last night I went to merb 0.4.0 via gem install and now any call to session[:foo] causes an error >> undefined method '[]' for nil:NilClass I have uninstalled and reinstalled merb with no luck. dependencies.rb use_orm :activerecord merb.yml :session_store: active_record Gems merb 0.4.0 merb_activerecord 0.4.2 Mac OSX Any help appreciated. From jonathan at new-bamboo.co.uk Wed Nov 7 09:56:08 2007 From: jonathan at new-bamboo.co.uk (Jonathan Conway) Date: Wed, 7 Nov 2007 14:56:08 +0000 Subject: merb 0.4.0 session issue In-Reply-To: References: Message-ID: <62E17284-42CB-4CBA-92F2-30C8E524A5DA@new-bamboo.co.uk> A few things are different with how you configure sessions in Merb 0.4.0. Try changing :session_store: active_record to :sql_session: true Hope this helps Jonathan ---- http://www.jaikoo.com On 7 Nov 2007, at 12:22, frazer horn wrote: > Not sure if anyone else has had this problem. > > I was running on merb edge fine a few days ago. Last night I went to > merb 0.4.0 via gem install and now any call to session[:foo] causes an > error >> undefined method '[]' for nil:NilClass > > I have uninstalled and reinstalled merb with no luck. > > dependencies.rb > use_orm :activerecord > > merb.yml > :session_store: active_record > > Gems > merb 0.4.0 > merb_activerecord 0.4.2 > > Mac OSX > > Any help appreciated. > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel From merb at dusty.name Wed Nov 7 10:05:41 2007 From: merb at dusty.name (Dusty Doris) Date: Wed, 7 Nov 2007 10:05:41 -0500 Subject: merb/sequel mutex on or off? proxy_balancer or no? Message-ID: Just a quick question to those of you using merb and sequel or datamapper. How do you setup your merb app? For example: merb -X off -c 5, then run mod_proxy_balancer or nginx to load balance between the 5 (or whatever #) of merb nodes? merb -X off -d, then simply use something like proxypass merb -c 5, keep the mutex lock and cluster it haproxy, swiftiply, evented mongrel...... What I'm curious about is if you are using sequel, do you typically remove those mutex locks? If so, is there a benefit still in running a clustered mongrel setup? Just curious to how others are setting up their applications. Right now I'm removing the mutex lock and setting up a cluster of 5 behind proxy_balancer and its working great. However, I was just curious to what others are doing. Thanks. Its looking great. I especially love the new provides :xml, :text, ... in the responder. Really nice idea. -Dusty Doris From ivey at gweezlebur.com Wed Nov 7 10:18:34 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Wed, 7 Nov 2007 09:18:34 -0600 Subject: merb 0.4.0 session issue In-Reply-To: References: Message-ID: On Nov 7, 2007, at 6:22 AM, frazer horn wrote: > I was running on merb edge fine a few days ago. Last night I went to > merb 0.4.0 via gem install and now any call to session[:foo] causes an > error >> undefined method '[]' for nil:NilClass > > I have uninstalled and reinstalled merb with no luck. I just installed merb and merb_activerecord from gems, created a new app, turned on AR sessions, did the migration, and sessions work. So to figure out why they don't work in your app, gonna need to see more info. Can you reply with relevant chunks of your merb.yml, dependencies.rb, schema.rb, controller, etc? Also, do you have merb_activerecord installed? The name changed from merb_active_record to merb_activerecord right before 0.4.0 released. From kevwil at gmail.com Wed Nov 7 10:36:00 2007 From: kevwil at gmail.com (Kevin Williams) Date: Wed, 7 Nov 2007 08:36:00 -0700 Subject: what did I do? In-Reply-To: <683a886f0711051934r21f1ee79td55776accb4e41d5@mail.gmail.com> References: <683a886f0711051934r21f1ee79td55776accb4e41d5@mail.gmail.com> Message-ID: <683a886f0711070736r4fa9548by601fa299cea1c801@mail.gmail.com> Seems to be fixed. Odd that I got no reply whatsoever, but hey, I'm glad it's fixed! Hooray for 0.4 being released! (and swiftiply being fixed) I can stop following trunk and stop bothering everyone with dumb questions. :) On Nov 5, 2007 8:34 PM, Kevin Williams wrote: > I'm following merb trunk. This morning I updated my gems, sync'd merb > source and installed the merb gem from source. I don't know if I did > something wrong, or if a new gem messed things up, or if there was a > merb change which broke something. Now I get this error: > > Request: REQUEST_URI: / (2007-11-05 20:27:04) > Params: {"action"=>"index", "controller"=>"articles"} > Cookies: {"_session_id"=>"fe8eea1f497d002ee39ad61cbd868a2b"} > Setting up session > undefined method `keys' for # - (NoMethodError) > /Users/kevwil/dev/git/rubyrubyroo/app/views/articles/index.html.haml:4 > /Library/Ruby/Gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:1863:in > `method_missing' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mixins/controller.rb:65:in `url' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/view_context.rb:73:in `send' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/view_context.rb:73:in > `method_missing' > (eval):11:in `_render_haml_1' > (eval):8:in `each' > (eval):8:in `_render_haml_1' > /Library/Ruby/Gems/1.8/gems/haml-1.7.1/lib/haml/engine.rb:435:in `send' > /Library/Ruby/Gems/1.8/gems/haml-1.7.1/lib/haml/engine.rb:435:in `compile' > /Library/Ruby/Gems/1.8/gems/haml-1.7.1/lib/haml/engine.rb:186:in `to_html' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/template/haml.rb:44:in > `transform' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mixins/render.rb:209:in `render' > /Users/kevwil/dev/git/rubyrubyroo/app/controllers/articles.rb:10:in `index' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:57:in > `send' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:57:in > `call_action' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/abstract_controller.rb:32:in > `dispatch' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/controller.rb:80:in `dispatch' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:53:in > `dispatch_action' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:35:in `handle' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mongrel_handler.rb:86:in > `process' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:155:in `process_client' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `each' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `process_client' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `initialize' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `new' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `initialize' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `new' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:282:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in > `each' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in `run' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:557:in `cloaker_' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in `call' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in > `initialize' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `new' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `mongrel_start' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:477:in `run' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 > /usr/bin/merb:16:in `load' > /usr/bin/merb:16 > undefined method `each' for # - (NoMethodError) > (erubis):144:in `dispatch_default_exception' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:95:in > `dispatch_default_exception' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:77:in > `dispatch_exception' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:39:in `handle' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/mongrel_handler.rb:86:in > `process' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:155:in `process_client' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `each' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:154:in `process_client' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `initialize' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `new' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:281:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `initialize' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `new' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel.rb:264:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:282:in `run' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in > `each' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:281:in `run' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:557:in `cloaker_' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in `call' > /Library/Ruby/Gems/1.8/gems/mongrel-1.1/lib/mongrel/configurator.rb:50:in > `initialize' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `new' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:548:in `mongrel_start' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:477:in `run' > /Library/Ruby/Gems/1.8/gems/merb-0.4.0/bin/merb:6 > /usr/bin/merb:16:in `load' > /usr/bin/merb:16 > > > Any suggestions? > > -- > Cheers, > > Kevin Williams > http://kevwil.com > From ivey at gweezlebur.com Wed Nov 7 10:39:55 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Wed, 7 Nov 2007 09:39:55 -0600 Subject: what did I do? In-Reply-To: <683a886f0711070736r4fa9548by601fa299cea1c801@mail.gmail.com> References: <683a886f0711051934r21f1ee79td55776accb4e41d5@mail.gmail.com> <683a886f0711070736r4fa9548by601fa299cea1c801@mail.gmail.com> Message-ID: <09F74F63-580F-44C0-ACFA-BFE7D22D77C8@gweezlebur.com> On Nov 7, 2007, at 9:36 AM, Kevin Williams wrote: > Seems to be fixed. Odd that I got no reply whatsoever, but hey, I'm > glad it's fixed! Yeah Ez pointed out your email right before we released. I didn't recognize the error you were getting as a url() issue. After someone else hit the same thing, I figured out what it was. From luislavena at gmail.com Thu Nov 8 08:04:53 2007 From: luislavena at gmail.com (Luis Lavena) Date: Thu, 8 Nov 2007 10:04:53 -0300 Subject: Back to ruby2ruby? Message-ID: <71166b3b0711080504q51618cb2xd3961bbf28539488@mail.gmail.com> Hello guys. I missed a lot of the development before 0.4 got out (btw, excellent work!). I checkout last night the merb-trunk code and run the specs, found that everything passes with 1 pending, but no errors or failures about missing ruby2ruby. There is a ticket (#274)[1] that discuss this, but I remember we discussed this back in September about depending on RubyInline... Also, the merb gem dependencies didn't state it, nor the documentation as ticket mention... ry dahl wrote a proof of concept extracting the count parameters part of ParseTree, what happened to that? Anyway, excellent progress and great looking site (still a few issues with small fonts on Firefox ;-) Regards, [1] http://merb.devjavu.com/ticket/274 [2] http://rubyforge.org/pipermail/merb-devel/2007-September/000209.html -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi From ivey at gweezlebur.com Thu Nov 8 10:22:10 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Thu, 8 Nov 2007 09:22:10 -0600 Subject: Back to ruby2ruby? In-Reply-To: <71166b3b0711080504q51618cb2xd3961bbf28539488@mail.gmail.com> References: <71166b3b0711080504q51618cb2xd3961bbf28539488@mail.gmail.com> Message-ID: <8D490CB7-899A-4B89-BA50-D4B507360CC3@gweezlebur.com> On Nov 8, 2007, at 7:04 AM, Luis Lavena wrote: > I checkout last night the merb-trunk code and run the specs, found > that everything passes with 1 pending, but no errors or failures about > missing ruby2ruby. It's only required if you want to use parameterized actions. From ivey at gweezlebur.com Mon Nov 12 14:33:54 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Mon, 12 Nov 2007 13:33:54 -0600 Subject: Sessions broken in 0.4.0 (includes hotfix) Message-ID: We've gotten several reports on #merb that each request gets a new session ID in 0.4.0. I quickly tested and verified. scoundrel tracked it down, and I think it's fixed. If you need to apply this by hand to your 0.4.0 install, it's a 1 line fix: Index: /trunk/lib/merb/controller.rb =================================================================== --- /trunk/lib/merb/controller.rb (revision 904) +++ /trunk/lib/merb/controller.rb (revision 961) @@ -12,5 +12,5 @@ self._subclasses = [] - self._session_id_key = :_session_id + self._session_id_key = '_session_id' self._session_expiry = Time.now + Merb::Const::WEEK * 2 This will be in 0.4.1 when it comes out RSN. From ez at engineyard.com Mon Nov 12 16:27:00 2007 From: ez at engineyard.com (Ezra Zygmuntowicz) Date: Mon, 12 Nov 2007 13:27:00 -0800 Subject: merb/sequel mutex on or off? proxy_balancer or no? In-Reply-To: References: Message-ID: <1E8CEEBF-2849-48BF-AD6F-F114E4AF7373@engineyard.com> Dusty- I usually turn off the mutex and use evented mongrel. gem install swiftiply then when you start merb: EVENT=1 merb -X off Cheers- -Ezra On Nov 7, 2007, at 7:05 AM, Dusty Doris wrote: > Just a quick question to those of you using merb and sequel or > datamapper. How do you setup your merb app? > > For example: > > merb -X off -c 5, then run mod_proxy_balancer or nginx to load balance > between the 5 (or whatever #) of merb nodes? > > merb -X off -d, then simply use something like proxypass > > merb -c 5, keep the mutex lock and cluster it > > haproxy, swiftiply, evented mongrel...... > > > What I'm curious about is if you are using sequel, do you typically > remove those mutex locks? If so, is there a benefit still in running > a clustered mongrel setup? Just curious to how others are setting up > their applications. Right now I'm removing the mutex lock and setting > up a cluster of 5 behind proxy_balancer and its working great. > However, I was just curious to what others are doing. > > Thanks. Its looking great. I especially love the new provides :xml, > :text, ... in the responder. Really nice idea. > > -Dusty Doris > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel Ezra Zygmuntowicz Founder & Ruby Hacker ezra at engineyard.com EngineYard.com From kevwil at gmail.com Tue Nov 13 12:53:23 2007 From: kevwil at gmail.com (Kevin Williams) Date: Tue, 13 Nov 2007 10:53:23 -0700 Subject: nitpicking :) Message-ID: <683a886f0711130953o35d847dfhe2cdc930b6f6d083@mail.gmail.com> The http://merbivore.com/get_merb.html#trunk page mentions the 0.4.0 version, but 0.4.1 is out. Is this a part of the site which will be constantly updated as part of the release cycle? The roadmap on merb.devjavu.com has outstanding tickets for 0.4.0 and 0.4.1, yet both versions are out. Were those issues fixed, or should they be bumped forward? Yeah, this is really anal crap, I know. I would be surprised if sending this doesn't piss someone off. That said, some days the little things are distracting enough to speak up about, you know? -- Cheers, Kevin Williams http://kevwil.com From ivey at gweezlebur.com Tue Nov 13 13:25:37 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Tue, 13 Nov 2007 12:25:37 -0600 Subject: nitpicking :) In-Reply-To: <683a886f0711130953o35d847dfhe2cdc930b6f6d083@mail.gmail.com> References: <683a886f0711130953o35d847dfhe2cdc930b6f6d083@mail.gmail.com> Message-ID: > The http://merbivore.com/get_merb.html#trunk page mentions the 0.4.0 > version, but 0.4.1 is out. Is this a part of the site which will be > constantly updated as part of the release cycle? Ez, who all has write to merbivore? > The roadmap on merb.devjavu.com has outstanding tickets for 0.4.0 and > 0.4.1, yet both versions are out. Were those issues fixed, or should > they be bumped forward? I've rolled them all to either 0.4.2 or Future, but others should feel free to disagree with my classification. Some *may* be fixed already. From ivey at gweezlebur.com Thu Nov 15 21:26:47 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Thu, 15 Nov 2007 20:26:47 -0600 Subject: Challenge Message-ID: The original: http://pastie.textmate.org/private/lqvrlyyvkv2kbugoxtiz6w Send your submissions to me by email or on #merb. I'll blog it, and pick a winner. The winner does not mean it makes it into Merb, just means I personally like it best. But it might make it into Merb. # Scenario: # You have a simple application that lists all the monkeys at the zoo. # Every monkey has a name, and that name is unique. # It is currently working. # # Your boss comes and asks you to change the "ugly" /monkeys/44 URLs # to be "pretty" and "SEO optimized" URLs like /monkeys/koko, with the # monkey's name in the URL. # # Challenge: # Design your perfect API for doing this, using any combination of # controller, model, and router changes. Submit it as a diff of this pastie. # # Degree of difficulty: # Don't complain that doing /monkeys/koko is dumb, or what happens # when there are two monkeys named koko. # # Submit your diffs to #merb # router: r.resources :monkeys class Monkey < MythicalORM end class Monkeys < Application def show(id) @monkey = Monkey.find(id) end def create(monkey) @monkey = Monkey.create(monkey) redirect url(:monkey, at monkey) end end From chris at oxdi.eu Fri Nov 16 04:14:02 2007 From: chris at oxdi.eu (Chris Farmiloe) Date: Fri, 16 Nov 2007 09:14:02 +0000 Subject: Challenge In-Reply-To: References: Message-ID: <80175437-9079-460D-A1A8-EF38BF401806@oxdi.eu> # psudo-untested-ruby-while-having-coffee code version by chrisfarms # # produces urls like /monkeys/3-your-keywords # # works for SEO, while maintaining all the benifits of a solid numeric ID # plus points for SEO... if the keywords are changed, 302 redirects will automatically # move the client to the right page.... solving the duplicate content issue or # 404 errors after fixing a typo in a 'slug' # # controller code should be untouched http://pastie.textmate.org/private/gcet24o9er4milpqemjjq On 16 Nov 2007, at 02:26, Michael D. Ivey wrote: > The original: > http://pastie.textmate.org/private/lqvrlyyvkv2kbugoxtiz6w > > Send your submissions to me by email or on #merb. I'll blog it, and > pick a winner. The winner does not mean it makes it into Merb, just > means I personally like it best. > > But it might make it into Merb. > > > > # Scenario: > # You have a simple application that lists all the monkeys at the zoo. > # Every monkey has a name, and that name is unique. > # It is currently working. > # > # Your boss comes and asks you to change the "ugly" /monkeys/44 URLs > # to be "pretty" and "SEO optimized" URLs like /monkeys/koko, with the > # monkey's name in the URL. > # > # Challenge: > # Design your perfect API for doing this, using any combination of > # controller, model, and router changes. Submit it as a diff of this > pastie. > # > # Degree of difficulty: > # Don't complain that doing /monkeys/koko is dumb, or what happens > # when there are two monkeys named koko. > # > # Submit your diffs to #merb > > > # router: > r.resources :monkeys > > class Monkey < MythicalORM > > end > > > class Monkeys < Application > def show(id) > @monkey = Monkey.find(id) > end > > def create(monkey) > @monkey = Monkey.create(monkey) > redirect url(:monkey, at monkey) > end > end > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20071116/8724d694/attachment.html From B.Candler at pobox.com Fri Nov 16 04:48:51 2007 From: B.Candler at pobox.com (Brian Candler) Date: Fri, 16 Nov 2007 09:48:51 +0000 Subject: Challenge In-Reply-To: References: Message-ID: <20071116094851.GA847@uk.tiscali.com> On Thu, Nov 15, 2007 at 08:26:47PM -0600, Michael D. Ivey wrote: > # Scenario: > # You have a simple application that lists all the monkeys at the zoo. > # Every monkey has a name, and that name is unique. > # It is currently working. Presumably it also has something like def index @monkeys = Monkey.find(:all) end > # Your boss comes and asks you to change the "ugly" /monkeys/44 URLs > # to be "pretty" and "SEO optimized" URLs like /monkeys/koko, with the > # monkey's name in the URL. > # > # Challenge: > # Design your perfect API for doing this What do you mean by 'API' here? Or is the idea to explore all the possibilities which might be implied? As far as I can see: (1) you could use an ORM which permits use of an arbitrary field as the primary key; in this case only the model would need to change. class Monkey < MythicalORM self.primary_key = 'name' end (In the case of ActiveRecord, I believe that non-integer ID fields are not supported. Also, if you intend retaining the old integer 'id' column in parallel with the monkey name primary key, beware that AR may no longer generate the next integer id for you automatically, so you may need to do this explicitly in a before_create hook) (2) modify Merb so the url() helper can use an arbitrary model field as the resource id, e.g. r.resources :monkeys, :resource_id => :name class Monkeys < Application def show(id) @monkey = Monkey.find_by_name(id) || (raise "No such monkey") end end The :resource_id is used by the url() helper to pick the correct attribute to put into the URL. But if the idea is to add some feature to Merb for this, I would suggest first a generalisation of the problem to allow for composite primary keys. e.g. if each monkey has a first name and last name, and the tuple (first name, last name) is unique, then allow resource URLs of the form /monkeys/koko/pops or /monkeys/koko;pops This introduces further difficulties (*), but is realistic when wanting to map a web application onto an existing schema which was designed in this way. (*) in particular: the database may have primary key tuples of the form ("","foo") and/or (null,"foo") > # Don't complain that doing /monkeys/koko is dumb, or what happens > # when there are two monkeys named koko Or what happens when a monkey's name contains a forward slash. (If you replace monkeys with car parts, IDs of the form xxx/yyy are not uncommon; with Rails at least, even encoding as %2F is treated as a path separator) Which reminds me of: http://xkcd.com/327/ Incidentally, when I wanted to do something similar to this in a Rails app, I ended up using URLs of the form /monkeys?name=koko Then if a single monkey matches, I redirect to /monkeys/44; if multiple monkeys match, I list them. Something like this: MAX_RESULT = 10 def index if params[:name] @monkeys = Monkey.find(:all, :conditions=>['name=?',params[:name]], :limit => MAX_RESULT, :order => 'name') render_monkeys('Monkeys by name') else @monkeys = Monkey.find(:all) end end def render_monkeys(title = 'Monkeys') @title = title if @monkeys.size == 1 redirect_to monkey_url(@monkeys.first) elsif @monkey.size == 0 flash.now[:notice] = 'Monkey not found' else if @monkeys.size == MAX_RESULT flash.now[:notice] = "Only the first #{MAX_RESULT} monkeys shown" end end You can extend the 'if' statement in index to allow for other ways of referring to the monkey, e.g. /monkeys?asset_tag=12345. Now, this suggests a question back to the boss: after the proposed change of URLs, what happens if you want to fetch a monkey given its original ID of 44? Would we need to provide a second URL of the form /monkeys?id=44 ? Or will the old ID just become a normal data attribute? Or is this change of "primary key" going to be so pervasive that we will delete the old id column from the database entirely? If multiple 'primary keys' are to be exposed, you could argue that this should be done orthogonally, e.g. /monkeys/id/44 /monkeys/name/koko /monkeys/asset_tag/12345 But this still begs the question of which form will be generated by the url() helper. So ultimately one of these is going to take precedence over all the others. Regards, Brian. From ivey at gweezlebur.com Fri Nov 16 09:52:13 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Fri, 16 Nov 2007 08:52:13 -0600 Subject: Challenge In-Reply-To: <80175437-9079-460D-A1A8-EF38BF401806@oxdi.eu> References: <80175437-9079-460D-A1A8-EF38BF401806@oxdi.eu> Message-ID: On Nov 16, 2007, at 3:14 AM, Chris Farmiloe wrote: > http://pastie.textmate.org/private/gcet24o9er4milpqemjjq Thanks, Chris, got it on the list. I wasn't going to comment on entries, but since this is only a sorta- contest (there will be a prize!) I figured it was OK. I had never thought of pushing it all into the model. It may be a "violation of MVC" to raise controller exceptions from inside models, but is that a bad thing? Raising "Moved" with the new name is excellent. So I guess the MVC purist in me was horrified, and the Resource guy in me thought this was super sexy. Have you used a pattern like this in production yet? BTW: Merb already defines MovedPermanently and MovedTemporarily, but they don't take the arg for the new URL. We should add that: raise MovedPermanently.new(new_url) From chris at oxdi.eu Fri Nov 16 10:15:41 2007 From: chris at oxdi.eu (Chris Farmiloe) Date: Fri, 16 Nov 2007 15:15:41 +0000 Subject: Challenge In-Reply-To: References: <80175437-9079-460D-A1A8-EF38BF401806@oxdi.eu> Message-ID: On 16 Nov 2007, at 14:52, Michael D. Ivey wrote: > I had never thought of pushing it all into the model. It may be a > "violation of MVC" to raise controller exceptions from inside models, > but is that a bad thing? Raising "Moved" with the new name is > excellent. I've been playing with a fork of merb for one production app, and for me ControllerExceptions are more like ApplicationExceptions not specific to controller-land > Have you used a pattern like this in production yet? On a few rails apps, I've used something similar, although without merb's exception controllers its a bit messy. try: http://www.africacollection.co.uk/pages/1-holidays-to-southern-africa-the-indian-ocean then http://www.africacollection.co.uk/pages/1-holidays-to-southern-africa-blah-blah-blah > BTW: Merb already defines MovedPermanently and MovedTemporarily, but > they don't take the arg for the new URL. We should add that: > raise MovedPermanently.new(new_url) A built in handler for the Moved__ error classes would be nice too. raise MovedTemporaily.new(url) would be roughly equal to redirect(url) and throw(:halt) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20071116/7f7c3761/attachment-0001.html From ivey at gweezlebur.com Fri Nov 16 10:19:11 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Fri, 16 Nov 2007 09:19:11 -0600 Subject: Challenge In-Reply-To: <20071116094851.GA847@uk.tiscali.com> References: <20071116094851.GA847@uk.tiscali.com> Message-ID: <061D0910-BF8D-48B0-B6D5-488C36D07847@gweezlebur.com> On Nov 16, 2007, at 3:48 AM, Brian Candler wrote: > Presumably it also has something like > def index > @monkeys = Monkey.find(:all) > end Yep just left them out for brevity. They're the standard CRUD actions. > What do you mean by 'API' here? Or is the idea to explore all the > possibilities which might be implied? By "Perfect API" I meant, "Assume Merb is your Perfect Framework, and works exactly as it should. What would you have to change in your app, using Merb's perfect API, to accomplish your task?" > (2) modify Merb so the url() helper can use an arbitrary model > field as the > resource id, e.g. > > r.resources :monkeys, :resource_id => :name You're at least the third person to suggest attaching this to the routes, so that seems like an approach worth exploring for Merb. > But if the idea is to add some feature to Merb for this Well, it's both. Merb needs some way to handle not using the id attribute of a model in URLs. Especially in the case where the models aren't even database backed. But this is also a contest, for making up cool and pretty APIs. > I would suggest first a generalisation of the problem to allow for > composite primary keys. > e.g. if each monkey has a first name and last name, and the tuple > (first name, last name) is unique, then allow resource URLs of the > form > > /monkeys/koko/pops > or /monkeys/koko;pops Tuples as URL segments...interesting. My brain immediately went to /monkeys/[koko,pops] but that's not legal. After spending too much time in the spec when I should be getting ready for work, I came up with this: /monkeys;koko,pops ; signifies params for a path segment....so it says "the collection of monkeys, limited by this tuple" ... legal, semantic....kinda pretty if you're a URI geek, too. I can't decide without more linking and parsing if / monkeys/;koko,pops would also be legal. Anyway, interesting stuff, thanks for the email. I didn't see an official entry into the contest, though. :) From B.Candler at pobox.com Fri Nov 16 11:16:32 2007 From: B.Candler at pobox.com (Brian Candler) Date: Fri, 16 Nov 2007 16:16:32 +0000 Subject: Challenge In-Reply-To: <061D0910-BF8D-48B0-B6D5-488C36D07847@gweezlebur.com> References: <20071116094851.GA847@uk.tiscali.com> <061D0910-BF8D-48B0-B6D5-488C36D07847@gweezlebur.com> Message-ID: <20071116161632.GA22771@uk.tiscali.com> On Fri, Nov 16, 2007 at 09:19:11AM -0600, Michael D. Ivey wrote: > Tuples as URL segments...interesting. My brain immediately went to > /monkeys/[koko,pops] but that's not legal. After spending too much > time in the spec when I should be getting ready for work, I came up > with this: > > /monkeys;koko,pops > > ; signifies params for a path segment....so it says "the collection > of monkeys, limited by this tuple" ... legal, semantic....kinda > pretty if you're a URI geek, too. FWIW, Rails have dropped their use of the semicolon, apparently because of some compatibility problems. i.e. they now use /monkeys/123/squawk instead of /monkeys/123;squawk See: http://weblog.rubyonrails.org/2007/10/5/rails-1-2-4-maintenance-release Given that a tuple is always of fixed size, I would be inclined towards /monkeys/koko/pops, if only because (a) in the degenerate case of the single-key tuple it's the same as now, and (b) it doesn't introduce any more characters which need escaping if they occur within the key columns. Given a composite key, perhaps the router should set the 'id' parameter to an array? This would be convenient if the ORM supports composite keys in this way, as you could still do Monkey.find(id) # id = ['koko','pops'] I don't know which, if any, ORMs would support this. But in any case you can always do Monkey.find_by_firstname_and_lastname(*id) || (raise "No banana") But in any case maybe it's better to name the key components explicitly, e.g. r.resources :monkeys, :resource_id=>[:firstname,:lastname] which could just build a pattern of monkeys/:firstname/:lastname and the routing code wouldn't have to change. > Anyway, interesting stuff, thanks for the email. I didn't see an > official entry into the contest, though. :) I don't know what the prize is, but I can probably live without it :-) Regards, Brian. From ivey at gweezlebur.com Fri Nov 16 11:20:23 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Fri, 16 Nov 2007 10:20:23 -0600 Subject: Challenge In-Reply-To: References: <80175437-9079-460D-A1A8-EF38BF401806@oxdi.eu> Message-ID: <1B33FCC6-3337-442A-8C63-B71AB0D2BD97@gweezlebur.com> On Nov 16, 2007, at 9:15 AM, Chris Farmiloe wrote: >> BTW: Merb already defines MovedPermanently and MovedTemporarily, but >> they don't take the arg for the new URL. We should add that: >> raise MovedPermanently.new(new_url) > > A built in handler for the Moved__ error classes would be nice too. > > raise MovedTemporaily.new(url) > > would be roughly equal to > > redirect(url) and throw(:halt) Yep, that should be in the default generated Exceptions controller. What sensible default should MovedPermanently use for the url? I guess just nil, and if you don't specify one moved_permanently would display the error. I'll work on this next week if no one else does. From chris at oxdi.eu Fri Nov 16 11:29:37 2007 From: chris at oxdi.eu (Chris Farmiloe) Date: Fri, 16 Nov 2007 16:29:37 +0000 Subject: uploads and swiftiply Message-ID: <1BD6F334-513E-4D7A-984D-29B6107B10C0@oxdi.eu> This is actually REALLY obvious, but I just thought i'd post it up here since it took a few brain clicks to dawn on me. Evented mongrels don't play nice with upload-progress systems. (although with the new nginx patch and a couple of mongrels it wouldn't be so bad.) From B.Candler at pobox.com Fri Nov 16 16:00:06 2007 From: B.Candler at pobox.com (Brian Candler) Date: Fri, 16 Nov 2007 21:00:06 +0000 Subject: Challenge In-Reply-To: <20071116161632.GA22771@uk.tiscali.com> References: <20071116094851.GA847@uk.tiscali.com> <061D0910-BF8D-48B0-B6D5-488C36D07847@gweezlebur.com> <20071116161632.GA22771@uk.tiscali.com> Message-ID: <20071116210006.GA4435@uk.tiscali.com> I just remembered a major problem with the boss' suggestion: what if a monkey's name collides with a controller action? For example, is /monkeys/new a 'new' action on the whole collection, or a 'show' action on an individual monkey whose name is 'new'? This pretty much *requires* IDs to be numeric, unless we accept a further rejigging of URLs, such as /monkeys/new /monkeys/show/koko /monkeys/edit/koko or /monkeys/*/new /monkeys/koko /monkeys/koko/edit or even /monkeys/new /monkey/koko /monkey/koko/edit The first of these most closely retains the controller/action semantic, but does not match the boss' URL spec, and it moves away fm the idea of an object as a 'resource' like a file in a filesystem. For another example of ambiguity, have a look at this bit of routing code, and consider what happens if a monkey's name is 'edit': next_level.match("/:id/edit").to_route.name(:"edit_#{route_singular_name}") next_level.match("/:action/:id").to_route.name(:"custom_#{route_singular_name}") (Unlikely? Well 'Edith' is a name, so I can imagine that 'Edit' might be a name in some other languages :-) I think these problems go away if semicolons are required for named actions, i.e. /monkeys;new /monkeys/koko /monkeys/koko;edit but at the moment Merb and Rails accept both ; and / Regards, Brian. From ivey at gweezlebur.com Fri Nov 16 18:41:29 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Fri, 16 Nov 2007 17:41:29 -0600 Subject: Challenge In-Reply-To: <20071116210006.GA4435@uk.tiscali.com> References: <20071116094851.GA847@uk.tiscali.com> <061D0910-BF8D-48B0-B6D5-488C36D07847@gweezlebur.com> <20071116161632.GA22771@uk.tiscali.com> <20071116210006.GA4435@uk.tiscali.com> Message-ID: <648E28BC-2812-4130-9909-8804B5C55D13@gweezlebur.com> > /monkeys/new > /monkey/koko > /monkey/koko/edit I've always preferred this style. The collection resource and the individual resource are different things. What about: Collection: /monkeys New form: /new-monkey Member: /monkey/koko Edit form: /monkey-editor/koko We're way off track from the Challenge, but I love talking about URLs. From ethan at echoditto.com Mon Nov 26 00:21:08 2007 From: ethan at echoditto.com (Ethan Winn) Date: Mon, 26 Nov 2007 00:21:08 -0500 Subject: Best Way to Write Helpers Using Markaby? Message-ID: <14AF6FEA-1DE3-4F4D-9BD9-3C6E99ED6142@echoditto.com> Hey there Merbers, I'm a Merb neophyte checking it out with a simple app exploration after being inspired by Mr. Katz's presentation @ JQueryCamp and with the desire to use Markaby if at all possible (I heart camping). I've done a little exploration of how to use Markaby in helper code, but any guidance would definitely be appreciated (I definitely do not understand the "Merb way"). At first I tried just putting the `tag_name do` blocks right in my helpers, but this didn't work out. What I've found does work is wrapping this code in `Markaby::Builder.new.html do` blocks, such as this: def tasks_table tasks Markaby::Builder.new.html do p "update tasks below" table do tasks.each do |task| task_row(task) end end end end While this works, I'm pretty sure that making a new builder instance for each helper call. What's the "right" way? Thanks. -- Ethan Winn ethan at echoditto.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20071126/07cd40a9/attachment.html From mattaimonetti at gmail.com Mon Nov 26 01:56:32 2007 From: mattaimonetti at gmail.com (Matt Aimonetti) Date: Sun, 25 Nov 2007 22:56:32 -0800 Subject: transition form respond_to to provides Message-ID: I really like the new mime type handler however I was trying to convert some code and couldn't figure out how. My rails action was handle 2 formats, html and xml respond_to do |format| format.html # show.html.erb format.xml do if @account.active? && @account.valid_referer?(session[:referer]) render :xml => @account.to_xml(:except => [:id, :created_at]) else render :text => 'your account has been disable' end end Now that I'm trying to switch this controller to Merb, I can't figure how to have a custom xml builder and how to have a condition to the mime type render. Any help would be greatly appreciated. Thanks -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20071125/30d8c973/attachment.html From ivey at gweezlebur.com Mon Nov 26 10:05:39 2007 From: ivey at gweezlebur.com (Michael D. Ivey) Date: Mon, 26 Nov 2007 09:05:39 -0600 Subject: transition form respond_to to provides In-Reply-To: References: Message-ID: <27DFEEB7-5F17-4B6D-86AE-BDDFC41B3FA1@gweezlebur.com> > respond_to do |format| > format.html # show.html.erb > format.xml do > if @account.active? && @account.valid_referer?(session > [:referer]) > render :xml => @account.to_xml(:except => > [:id, :created_at]) > else > render :text => 'your account has been disable' > end > end Here's an untested quick rewrite. provides :xml if content_type == :xml if @account.active? && @account.valid_referer?(session[:referer]) render :xml => @account.to_xml(:except => [:id, :created_at]) else "Your account has been disabled." end else render end From wayneeseguin at gmail.com Mon Nov 26 11:48:38 2007 From: wayneeseguin at gmail.com (Wayne E. Seguin) Date: Mon, 26 Nov 2007 11:48:38 -0500 Subject: [ANN] WNY Ruby Users Group, first meeting Message-ID: Hello friends, When: Nov 26th Meetup (Wed 7pm) Where: Spot Coffee in downtown Buffalo, side room ( http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=227+Delaware+Ave,+Buffalo,+Erie,+New+York+14202,+United+States&sll=42.890586,-78.876839&sspn=0.05886,0.090294&ie=UTF8&z=17&iwloc=addr&om=1 ) Duration: 1-2 hours http://www.wnyruby.com/ I hope to see you all there! ~Wayne From john at smokinggun.com Mon Nov 26 13:47:09 2007 From: john at smokinggun.com (John Weir) Date: Mon, 26 Nov 2007 13:47:09 -0500 Subject: Loading a specific version of MERB gem Message-ID: greetings, i have a project based around merb 0.3.7 and I do not want to fiddle with it one bit. and now I want to start a new project running 0.4.2(and beyond). what is the recommend method of starting merb from a specific gem version? thanks - jw From B.Candler at pobox.com Mon Nov 26 15:03:31 2007 From: B.Candler at pobox.com (Brian Candler) Date: Mon, 26 Nov 2007 20:03:31 +0000 Subject: Loading a specific version of MERB gem In-Reply-To: References: Message-ID: <20071126200331.GA27554@uk.tiscali.com> On Mon, Nov 26, 2007 at 01:47:09PM -0500, John Weir wrote: > i have a project based around merb 0.3.7 and I do not want to fiddle > with it one bit. and now I want to start a new project running > 0.4.2(and beyond). what is the recommend method of starting merb from > a specific gem version? rubygems provides such a mechanism: try merb _0.3.7_ [any other args] Type the underscores literally - they are not just there for emphasis :-) Here's how it works: $ cat /usr/bin/merb #!/usr/bin/env ruby # # This file was generated by RubyGems. # # The application 'merb' is installed as part of a gem, and # this file is here to facilitate running it. # require 'rubygems' version = "> 0" if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then version = $1 ARGV.shift end gem 'merb', version load 'merb' From gthoppae at gmail.com Fri Nov 30 05:12:16 2007 From: gthoppae at gmail.com (Gnanasekaran Thoppae) Date: Fri, 30 Nov 2007 11:12:16 +0100 Subject: Running merb app via fcgi Message-ID: <1AA6EBC0-AC34-40B3-962C-E5714D7DA46A@gmail.com> Hi all, I would like to know if there is a .htaccess template config to run Merb apps via fcgi under apache. If yes, where I can I find it? Thanks. -Gnana