Yes, it is,

Look at the API 

http://api.rubyonrails.org/classes/ActionController/Base.html 

and make a search for "action_name". Yo will see that it is an attribute of the 
class and indeed is 
almost sure supported by an instance variable of the same name, making 
@action_name a bad choice 
for personal variables and, as you could be thinking right now, totally 
innecesary.

Also take a look at, 

http://api.rubyonrails.org/classes/ActionView/Base.html

Search the documentation for the attributes of the class. You will find there a 
"controller" 
attribute, then you can replace invocations in your template as:

        Controller is <%= controller.name %>
        Action was <%= controller.action_name  %> 

--Mansay


On Fri 01 May 2009 6:43:15 pm westhielke wrote:
> Hi,
>
> I've encountered a strange problem with exercise 1.5 of the Rails
> Action Controller lesson, which doesn't turn out as described in the
> exercise description.
>
> The controller has the statements:
>
>     @controller_name = params[:controller]
>     @action_name = params[:action]
>
> and the say_hello.rhtml has:
>
>   Controller is <%= @controller_name %>
>   <br/>
>   Action was <%= @action_name %> !
>   <br/>
>
> When I run it, the screen shows nothing for the action, i.e.,
>
>    Controller is hello
>    Action is
>
> I checked the log and the params[:action] is definitely "index".
>
> After some fooling around, I determined that it works fine, if I
> change the variable name to anything other than @action_name. For
> example, if I make it "@action_nam" or "@actionx", then it works.
>
> Any ideas why? Is "@action_name" a pre-defined variable or something,
> which gets set internally after the controller changes the value?
>
> --Wes
>
>
>
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to