[Nitro] Passing data from a controller to a template

James Britt james_b at neurogami.com
Sat Jun 3 10:16:33 EDT 2006

Jonathan Buch wrote:

> James wrote: 
>>Could not one just use the controller class (i.e, some_controller.rb) to
>>define data accesor methods, and omit the specific action methods?
>>So that, for example, MainController would not define an 'index' method;
>>index.xhtml would reference assorted methods defined in MainController
>>and render the results.
>>(This means that any business logic associated with the call to index
>>would either be in index.xhtml, or would emerge from the calls made by
>>index.xhtml to the various data accessor methods of MainController.)
> I'm not really sure how this would work.. Basically you would determine the
> 'path' of a 'action' (meaning the index.xhtml) by its location in the
> template folder?


> What about nice-urls? or would it just skip the .xhtml. How do you handle
> `/index/foo` or `/index?foo=bar`?

Oh, I don't know.  I was tossing out the idea to see if others thought 
it interesting or useful or broken or whatever.

> What we have now, is a tight coupling between View and Controller.. maybe
> this idea would loosen this? But I'm not sure, since it sounds like the
> View would have too much processing in it...

Well, I don't have an example use case, so it's a bit abstract, but my 
general thought was that if a view called foo(), bar(), and baz(), then 
each of those would be altering server state and, in turn, possibly 
altering what the next method might return.

James Britt

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://yourelevatorpitch.com  - Finding Business Focus

More information about the Nitro-general mailing list