I tried to write a simple single-resource app the other day to help
with some debugging. I noticed the old REST helper has gone, to be
replaced with contrib/rest
But the new contrib/rest is incomplete. It routes all GET requests to
show, where it needs to route "/resource" and "/resource/1"
differently. Because of it rewriting the URL, this is actually quite
hard. It generates "/resource/1/show" instead of "/resource/show/1",
which means it tries to call "Controller#1('show')" instead of
"Controller#show('1')".
Because I couldn't see a way round the problems I eventually gave up
and used Merb instead. There it's possible to do this:
Merb::Router.prepare do
resources :my_resource
end
(The Merb router is one of the best things about Merb.)
Is there an easy way to do REST routes in Ramaze?
And, as an idle thought, would it possible to use the Merb router in
Ramaze? I haven't dug into the internals to investigate it, in case
someone can give an easy yes/no/maybe.
Cheers
Ashley
--
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran
>
> Is there an easy way to do REST routes in Ramaze?
I had frustration with the REST code in Ramaze, and decided that the
application should not be concerned with how things get to it.
So I wrote some Rack middleware to handle that.
http://github.com/Neurogami/restafarian
It may offer some useful stuff.
>
> And, as an idle thought, would it possible to use the Merb router in
> Ramaze? I haven't dug into the internals to investigate it, in case
> someone can give an easy yes/no/maybe.
Good question.
--
James Britt
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.neurogami.com - Smart application development
> I had frustration with the REST code in Ramaze, and decided that the
> application should not be concerned with how things get to it.
I fully agree. I'm not personally too keen on Controller.map
(presumably actually included in either Innate::Node or some other
module - I'm not yet familiar with any of the internals...), although
it's an easy way to get things going.
> So I wrote some Rack middleware to handle that.
>
> http://github.com/Neurogami/restafarian
>
> It may offer some useful stuff.
Thanks for the link. I've never written Rack middleware, so it's
still a bit foreign to me. It's a shame there are no specs for it, as
that would make it easier to see what the transform is doing.
> Good question.
I think I may just roll my sleeves up and have a go. At worst, it
won't work, but I'll have learnt a lot more about Ramaze and Merb (and
possibly Rack).
I agree as well. For our company's RESTful API I have a 90 line
Ramaze::Rewrite dispatcher which I need to modify each time I add a
new resource.
This was the only way to shoehorn REST into Ramaze :(
Clive
> I agree as well. For our company's RESTful API I have a 90 line
> Ramaze::Rewrite dispatcher which I need to modify each time I add a
> new resource.
> This was the only way to shoehorn REST into Ramaze :(
Hmmm, hmmm, hmmm...
How much would everyone here like to be able to use the Merb (RESTful)
router in Ramaze? If there's any demand, I might make a serious stab
at it. When it's not Friday night...
I'm still happy with Merb, but I'm a bit concerned with the lack of
progress due to "Rails 3". I like a lot of things in Ramaze, just not
the routing. But I'd like more input from more experienced Ramaze
users/developers as to what the roadmap is.
> Source:
>
> http://github.com/carllerche/rack-router
>
> So definitely +1.
Looks like there's interest in this idea then. The rack-router project looks like it has stalled though. I'm gonna have to see if I can squeeze in any time to work on this. Right now, routing is putting me off using Ramaze more.