One of the things that I miss when going back to cf is how easy it is  
for 1 controller to provide different types of data to the caller.   
For instance, I have a "policy" controller.  For my "show" action the  
following responses are available.

http://myawesomeapp.com/users/someuserid/policies/AX0800001 -- this  
serves up an html version
http://myawesomeapp.com/users/someuserid/policies/AX0800001.xml --  
servers up an xml dump of the policy
http://myawesomeapp.com/users/someuserid/policies/AX0800001.js --  
servers up a json package
http://myawesomeapp.com/users/someuserid/policies/AX0800001.print --  
this is my custom mime type that serves a printer friendly version
http://myawesomeapp.com/users/someuserid/policies/AX0800001.pdf --  
well, you get the idea.

and the controller code that handles this is simple

responds_to do |format|
    format.html { #render the html view template in the views  
directory, this automatically finds show.html.erb }
    format.xml [EMAIL PROTECTED]
    format.js [EMAIL PROTECTED]
    format.print { #render the print vew template...this automatically  
find the show.print.erb template}
    format.pdf {PolicyPdf.generate(@policy)}
end

Also, since the above urls are nested resources...Users have  
policies...it's super simple to scope the policies so that the users  
only see their own policies.

Doing this enabled me to make a normal html based app, move portions  
of it to ajax/xhr and then start to transition it to flex without  
having to change any of the base logic.


On Aug 5, 2008, at 7:48 PM, denstar wrote:

> Well, my love just keeps getting re-kindled.
>
> I'm really digging Railo 3!  And Hibernate has been quite a bit of fun
> to mess around with-- that sucker is *rich* with functionality.
>
> That said, I'm really leaning towards meta-programming more than doing
> some specific language.
>
> The power of meta is REAL!  REAL I SAY!
>
> In a meta-powerful kind of way (and I'm a meta-kinda guy, so we're  
> cake).
>
> -- 
> Java is pretty nice.
>
> On Tue, Aug 5, 2008 at 12:58 PM, Maureen wrote:
>> I occasionally cheat on CF with other environments - Ruby-on-Rails,
>> ASP.NET, etc.. But I always come back.  Bottom line, it's still the
>> best tool for the job.
>>
>> On Tue, Aug 5, 2008 at 9:51 AM, Zaphod Beeblebrox wrote:
>>
>>> well.....while I love my CF-Community peeps, I'm falling out of love
>>> with CF.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:265390
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5

Reply via email to