How can I detect the controller and action from a request? Thanks..
@params[:controller] and @params[:action] csn --- Matias Surdi <matiassurdi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I detect the controller and action from a request? > > Thanks.. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >__________________________________________ Yahoo! DSL – Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com
In views: controller.name controller.action_name will give you the controller and action names. On 04/12/05, Matias Surdi <matiassurdi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > How can I detect the controller and action from a request? > > Thanks.. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Sun, Dec 04, 2005 at 03:10:07PM -0500, Hammed Malik wrote:> In views: > > controller.name > controller.action_nameYou 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 -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
I stand corrected. Thanks. On 04/12/05, Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org> wrote:> > On Sun, Dec 04, 2005 at 03:10:07PM -0500, Hammed Malik 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 > -- > Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hammed Malik escribió:> I stand corrected. Thanks. > > On 04/12/05, *Marcel Molina Jr.* > <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org > <mailto:marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>> wrote: > > On Sun, Dec 04, 2005 at 03:10:07PM -0500, Hammed Malik wrote: > > In views: > > > > controller.name <http://controller.name> > > controller.action_name > > You can''t just do controller.class.name > <http://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 > -- > Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org > <mailto:marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > <mailto:Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/railsthanks everybody, I solved my problem with these things you said me... thanks.. Matias