On Wed, Sep 10, 2008 at 8:02 PM, Corin Moss <[EMAIL PROTECTED]> wrote:
>
>> What's really interesting is the
>> Rufus::Sixjo is eating that get method, and returning its own array
>> (with contents GET#<Rufus::Sixjo::Route:0xb6c4762c>).
>>
> Ok, I've found the culprit in sixjo (line 384 in version 0.1.3 of the gem)
>
> #--
> # the methods for registering the routes
> #++
> [ :post, :get, :put, :delete ].each do |v|
> module_eval <<-EOS
> def #{v} (rt, opts={}, &blk)
> (@routes ||= []) << [ '#{v.to_s.upcase}', Route.new(rt, opts),
> blk ]
> end
> EOS
> end
>
> And I can see why it's there - so I'm not entirely sure how to get
> around it!
Hi Corin,
there are 2 ways around it : a long one, and a shorter one.
The real culprit is there :
http://github.com/jmettraux/ruote-rest/tree/r0.9.19/lib/ruote_rest.rb#L45
(No, the real culprit is you because you have an Object with a get()
method, kidding ;) )
So the long way would imply wrapping everything in a module like
---8<---
module Ruote::Rest
...
end
--->8---
But that's lots of work (fortunately there are the tests).
The shorter way is to bind uppercase GET, POST and co like that :
---8<---
#--
# the methods for registering the routes
#++
[ :post, :get, :put, :delete ].each do |v|
module_eval <<-EOS
def #{v.to_s.upcase} (rt, opts={}, &blk)
(@routes ||= []) << [ '#{v.to_s.upcase}', Route.new(rt, opts), blk ]
end
EOS
end
--->8---
and then make sure that all the source files under lib/res/ do GET,
POST, PUT, ... instead of get, post, put, ... Fortunately, there are
the tests.
There are probably other ways, but that's all I could think for now.
Hope this will help, cheers,
--
John Mettraux - http://jmettraux.wordpress.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenWFEru users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---