Detect current controller and action


#1

How can I detect the controller and action from a request?

Thanks…


#2

@params[:controller] and @params[:action]

csn

— Matias S. removed_email_address@domain.invalid wrote:

How can I detect the controller and action from a request?

Thanks…


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


#3

In views:

controller.name
controller.action_name

will give you the controller and action names.


#4

On Sun, Dec 04, 2005 at 03:10:07PM -0500, Hammed M. wrote:

In views:

controller.name
controller.action_name

You can’t just do controller.class.name because the controller class is
called
FooController. Like ‘action_name’, there is a specialized
‘controller_name’
method.

PublicationController.new().class.name
=> “PublicationController”

PublicationController.new().controller_name
=> “publication”

marcel


#5

I stand corrected. Thanks.


#6

Hammed M.
escribió:> > controller.action_name

 >> PublicationController.new().controller_name
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

thanks everybody, I solved my problem with these things you said me…

thanks…

Matias