[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: rails use case

Tony Targonski

4/11/2005 8:51:00 PM

-----Original Message-----
From: ritchie [mailto:ritchie@ipowerhouse.com]
Sent: Monday, April 11, 2005 4:35 PM
To: ruby-talk ML
Subject: Re: rails use case

So, is it possible for the page to call it's own controller, an
inversion of the usual process, page gets called from
"SwitcherController", then the page does

<% pagecontroller %>

so that after the call

<%=@wow%> is defined??
-----------------------------

You can definitely do that within a single controller.

class TestController < ApplicationController
def index
@foo = "bar"
switch if rand < 0.5
render_template "<%= @foo %>"
end

def switch
@foo = "not quite bar"
end
end

About 50% of the time another action will be called that alters the
variable that is rendered in the template.

--Tony