[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

RubyOnRails - One view, many actions

infiliset

11/11/2007 8:32:00 PM

Hi all,
I've got a view named "prompt.rhtml"and a controller named "customer"
with some actions ("prompt", "getdata", and so on...). Of course, the
URL "/customer/prompt" is associated to the action "prompt" and then
to the view "prompt.rhtml", but is it possible to associate the action
"getdata" with the view "prompt.rhtml"? If so, how can I do this?


Thanks,
Matthew

4 Answers

Pat Maddox

11/11/2007 8:53:00 PM

0

On Nov 11, 2007 12:35 PM, <infiliset@gmail.com> wrote:
> Hi all,
> I've got a view named "prompt.rhtml"and a controller named "customer"
> with some actions ("prompt", "getdata", and so on...). Of course, the
> URL "/customer/prompt" is associated to the action "prompt" and then
> to the view "prompt.rhtml", but is it possible to associate the action
> "getdata" with the view "prompt.rhtml"? If so, how can I do this?
>
>
> Thanks,
> Matthew
>
>
>

render :action => "prompt"

or

render :template => "customer/prompt"

Pat

infiliset

11/12/2007 8:27:00 AM

0

On 11 Nov, 21:53, Pat Maddox <perg...@gmail.com> wrote:
> On Nov 11, 2007 12:35 PM, <infili...@gmail.com> wrote:
>
> > Hi all,
> > I've got a view named "prompt.rhtml"and a controller named "customer"
> > with some actions ("prompt", "getdata", and so on...). Of course, the
> > URL "/customer/prompt" is associated to the action "prompt" and then
> > to the view "prompt.rhtml", but is it possible to associate the action
> > "getdata" with the view "prompt.rhtml"? If so, how can I do this?
>
> > Thanks,
> > Matthew
>
> render :action => "prompt"
>
> or
>
> render :template => "customer/prompt"
>
> Pat


Hi Pat,
if I use

render :action => "prompt"

in "getdata" action, I have:

getdata (action) -> prompt (action) -> prompt (view)

but I'd like to have:

getdata (action) -> prompt (view)

Is it possible?


Thank you,
Matthew

Pat Maddox

11/12/2007 9:02:00 AM

0

On Nov 12, 2007 12:30 AM, <infiliset@gmail.com> wrote:
> On 11 Nov, 21:53, Pat Maddox <perg...@gmail.com> wrote:
>
> > On Nov 11, 2007 12:35 PM, <infili...@gmail.com> wrote:
> >
> > > Hi all,
> > > I've got a view named "prompt.rhtml"and a controller named "customer"
> > > with some actions ("prompt", "getdata", and so on...). Of course, the
> > > URL "/customer/prompt" is associated to the action "prompt" and then
> > > to the view "prompt.rhtml", but is it possible to associate the action
> > > "getdata" with the view "prompt.rhtml"? If so, how can I do this?
> >
> > > Thanks,
> > > Matthew
> >
> > render :action => "prompt"
> >
> > or
> >
> > render :template => "customer/prompt"
> >
> > Pat
>
>
> Hi Pat,
> if I use
>
> render :action => "prompt"
>
> in "getdata" action, I have:
>
> getdata (action) -> prompt (action) -> prompt (view)
>
> but I'd like to have:
>
> getdata (action) -> prompt (view)
>
> Is it possible?
>
>
> Thank you,
> Matthew
>
>
>

What? No you don't. It just runs the getdata action and renders the
view that corresponds to the action named "prompt." It doesn't run
that other action. Anyway, I also showed you another way with render
:template.

Pat

Pat Maddox

11/12/2007 9:03:00 AM

0

On Nov 12, 2007 1:02 AM, Pat Maddox <pergesu@gmail.com> wrote:
>
> On Nov 12, 2007 12:30 AM, <infiliset@gmail.com> wrote:
> > On 11 Nov, 21:53, Pat Maddox <perg...@gmail.com> wrote:
> >
> > > On Nov 11, 2007 12:35 PM, <infili...@gmail.com> wrote:
> > >
> > > > Hi all,
> > > > I've got a view named "prompt.rhtml"and a controller named "customer"
> > > > with some actions ("prompt", "getdata", and so on...). Of course, the
> > > > URL "/customer/prompt" is associated to the action "prompt" and then
> > > > to the view "prompt.rhtml", but is it possible to associate the action
> > > > "getdata" with the view "prompt.rhtml"? If so, how can I do this?
> > >
> > > > Thanks,
> > > > Matthew
> > >
> > > render :action => "prompt"
> > >
> > > or
> > >
> > > render :template => "customer/prompt"
> > >
> > > Pat
> >
> >
> > Hi Pat,
> > if I use
> >
> > render :action => "prompt"
> >
> > in "getdata" action, I have:
> >
> > getdata (action) -> prompt (action) -> prompt (view)
> >
> > but I'd like to have:
> >
> > getdata (action) -> prompt (view)
> >
> > Is it possible?
> >
> >
> > Thank you,
> > Matthew
> >
> >
> >
>
> What? No you don't. It just runs the getdata action and renders the
> view that corresponds to the action named "prompt." It doesn't run
> that other action. Anyway, I also showed you another way with render
> :template.
>
> Pat
>

Also I just noticed this is on rubytalk...you should direct any Rails
messages to the rails mailing list.

Pat