[LRUG] Naming...

Jonathan Leighton turnip at turnipspatch.com
Tue May 22 12:30:52 PDT 2007


Well I found that a lot of my shared partials and layouts were
referencing the resource, or the url helpers, but they had to be written
in a way which wasn't specific to a particular controller (as they span
across multiple controllers). So I wrote some methods in the
ApplicationHelper but I thought it would be cleaner and more powerful to
implement properly as a plugin.

If you are interested, the current code is here:
http://svn.turnipspatch.com/public/restflection/. I've still got a few
things to do but I should be releasing it soonish.

Cheers

Jon

On Tue, 2007-05-22 at 10:15 +0100, Paul Doerwald wrote:
> I'm not clear how or why you would use this? I'm interested to get in  
> your head on this, as it's a problem I've wondered about in the past  
> (although not quite in a REST context).
> 
> Paul.
> 
> 
> On 21-May-07, at 7:38 PM, Jonathan Leighton wrote:
> 
> > Hey all,
> >
> > I'm working on a Rails plugin called "Restflection" which provides
> > reflection for resources (I know, the name's cheesy ;). In other  
> > words,
> > you can get the resource/url/path/whatever without knowing it is an
> > "account" as opposed to an "article". I am struggling a bit with
> > deciding how to expose it. I don't want to pollute the namespace by
> > providing a load of methods in the controller/view, so I was thinking
> > along these lines:
> >
> > Singular:
> >
> > resource_reflection.resource                  -> @account
> > resource_reflection.resource=                 -> @account=
> > resource_reflection.name                      -> "account"
> > ...
> >
> > Plural:
> >
> > resources_reflection.resources                  -> @accounts
> > resources_reflection.resources=                 -> @accounts=
> > resources_reflection.name                       -> "accounts"
> > ...
> >
> > But what do you think of this?
> >
> > Singular:
> >
> > restflect(:member).it
> > restflect(:member).it = "Foo"
> > restflect(:member).name
> >
> > Plural:
> >
> > restflect(:collection).it
> > restflect(:collection).it = ["Foo", "Bar]
> > restflect(:collection).name
> >
> > My main problem is exposing the actual @account(s) object -
> > "resource(s)" is repetition but "it" doesn't seem very descriptive. I
> > think maybe I like the latter better though.
> >
> > Cheers
> >
> > Jon
> >
> > _______________________________________________
> > chat mailing list
> > chat at lrug.org
> > http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> 
> _______________________________________________
> chat mailing list
> chat at lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org




More information about the Chat mailing list