Forum: Ruby on Rails render functionality

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
sjf_control (Guest)
on 2007-07-12 01:31
(Received via mailing list)
I understand the difference between render and redirect (at least I
think I do...)
But there still seems to be some confusion in my mind between
     render :action => :some_action
and
     render :action => "some_action"

It would seem the second form (with the action target in quotes) just
renders "some_action.rhtml"
However, the first form using the colon fomat seems to call the action
method -- a direct contradiction of the explanation given in the
Pragmatic Programmer's Agile Web D. book (page 428).

If somebody has some explanation of how these two formats differ, I
sure would appreciate a response.

Thanks,
sjf
Javier G. (Guest)
on 2007-07-12 01:42
(Received via mailing list)
sjf,

On 7/11/07, sjf_control <removed_email_address@domain.invalid> wrote:
>
> I understand the difference between render and redirect (at least I
> think I do...)
> But there still seems to be some confusion in my mind between
>      render :action => :some_action
> and
>      render :action => "some_action"

These are equivalent, it's just that the first you are using a symbol
(:symbol_name) and the second you are using a string, but both lines
will do the same thing.

> Thanks,
> sjf
>
>
> >
>


Javier G.
Bill W. (Guest)
on 2007-07-12 05:49
(Received via mailing list)
Hi,

sjf_control wrote:
> there still seems to be some confusion in my mind between
>     render :action => :some_action
> and
>     render :action => "some_action"
>
> It would seem the second form (with the action target in quotes) just
> renders "some_action.rhtml"
> However, the first form using the colon fomat seems to call the action
> method

If you can supply a succinct test case that illustates this behavior,
please
do.  There is not supposed to be a difference, but perhaps you've found
a
bug.

Best regards,
Bill
This topic is locked and can not be replied to.