This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
rc /
| name | age | message | |
|---|---|---|---|
| |
Readme.rdoc | Tue Sep 29 01:57:27 -0700 2009 | |
| |
init.rb | Mon Sep 28 00:40:14 -0700 2009 | |
| |
lib/ | Tue Sep 29 01:33:44 -0700 2009 | |
| |
spec/ | Mon Sep 28 00:40:14 -0700 2009 |
Readme.rdoc
rc
Rewrite of resources_controller, main aim is to make backend ORM and controller arch pluggable. Subsidiary aim API improvements. There shall be an rc_bc plugin that aims at backwards compat with resources_controller.
It’s work in progress!
Path
When rc has parsed a path against a path_spec, you get an rc path, with this you can do all of the relative resource stuff you might want to do
e.g.
Spec: Singleton: "account", Polymorphic: "commentable", Keyed: "comment" request.path: '/account/posts/3/comments/2' Rc::Path contains the records and the rc path_spec info p.resource # => <Comment: 2> p.parents # => [<User:1>, <Post:3>] p.member # => [:account, <Post: 3>, <Comment: 2>] # suitable for passing to polymorphic_path p.collection # => [:account, <Post: 3>, :comments] # as above # go up the path p.up # => new Rc::Path for immediately enclosing p.up.resource # => <Post: 3> p.up.parents # => [<User:1>] p.up.member # => [:account, <Post: 3>] p.up.collection # => [:account, :posts] # go to the comment path for another comment in same context p.up.member << @comment # => [:account, <Post: 3>, <Comment: 5>]
PathSpec
Specify a RESTful resource
# two keyed resources
p = Rc.path_spec :forum, :post
=> #<Rc::PathSpec: [#<Rc::Spec::Keyed: /forums/:forum_id {name:forum}>, #<Rc::Spec::Keyed: /posts/:post_id {name:post}>]>
p.to_s
=> "/forums/:forum_id/posts/:post_id"
p.to_regexp
=> /^\/forums\/[^\/]+\/posts\/[^\/]+$/
Match, or expand an incomplete (e.g. with glob or polymorphic) path spec
g = Rc.path_spec '*', :post
=> #<Rc::PathSpec: [#<Rc::Spec::Glob: /*>, #<Rc::Spec::Keyed: /posts/:post_id {name:post}>]>
p = g.expand '/foo/bars/3/posts/4'
p.to_s
=> "/foo/bars/:bar_id/posts/:post_id"
g.expand '/foo/bars/3'
=> false
g.match? '/foo/1/posts/2'
=> true







