I was using @controller_name in some of my views to get the current controller but this is missing now from 0.13 I replaced it with @params["controller"] which looks better with @params["action"] anyhow Nev _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
On Jul 6, 2005, at 6:14 PM, Neville Burnell wrote:> I was using @controller_name in some of my views to get the current > controller but this is missing now from 0.13 > > I replaced it with @params["controller"] which looks better with > @params["action"] anyhowOh Doctor, my <%=h controller.controller_name %> is <%=h controller.action_name %>ing! jeremy
Neville Burnell wrote:> I was using @controller_name in some of my views to get the current > controller but this is missing now from 0.13 > > I replaced it with @params["controller"] which looks better with > @params["action"] anyhow > > Nev > >So umm where is this change documented? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
On Jul 6, 2005, at 6:57 PM, Sean T Allen wrote:> Neville Burnell wrote: >> I was using @controller_name in some of my views to get the >> current controller but this is missing now from 0.13 >> >> I replaced it with @params["controller"] which looks better with >> @params["action"] anyhow > > So umm where is this change documented?It was never a feature. controller.controller_name and controller.action_name have always been the way to access this info. jeremy
Jeremy Kemper wrote:> On Jul 6, 2005, at 6:57 PM, Sean T Allen wrote: > >> Neville Burnell wrote: >> >>> I was using @controller_name in some of my views to get the current >>> controller but this is missing now from 0.13 >>> >>> I replaced it with @params["controller"] which looks better with >>> @params["action"] anyhow >> >> >> So umm where is this change documented? > > > It was never a feature. controller.controller_name and > controller.action_name have always been the way to access this info. >And its what exactly now? controller.params["controller"] controller.params["action"] ? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
It has always been controller.controller_name controller.action_name -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Sean T Allen Sent: Thursday, 7 July 2005 1:06 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Rails 0.13 gotcha Jeremy Kemper wrote:> On Jul 6, 2005, at 6:57 PM, Sean T Allen wrote: > >> Neville Burnell wrote: >> >>> I was using @controller_name in some of my views to get the current>>> controller but this is missing now from 0.13 >>> >>> I replaced it with @params["controller"] which looks better with >>> @params["action"] anyhow >> >> >> So umm where is this change documented? > > > It was never a feature. controller.controller_name and > controller.action_name have always been the way to access this info. >And its what exactly now? controller.params["controller"] controller.params["action"] ?
No, the original poster said that @controller_name, @action_name were removed. This isn''t the same thing. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Sean T Allen Sent: Thursday, 7 July 2005 2:59 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Rails 0.13 gotcha Right but the initial poster said that had been removed... So I take it... that they werent? Wayne Robinson wrote:>It has always been > > controller.controller_name > controller.action_name > > >
And, if you want to use these within a controller just use: controller_name action_name They a instance methods -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Wayne Robinson Sent: Thursday, 7 July 2005 2:54 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails] Rails 0.13 gotcha No, the original poster said that @controller_name, @action_name were removed. This isn''t the same thing. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Sean T Allen Sent: Thursday, 7 July 2005 2:59 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Rails 0.13 gotcha Right but the initial poster said that had been removed... So I take it... that they werent? Wayne Robinson wrote:>It has always been > > controller.controller_name > controller.action_name > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Right but the initial poster said that had been removed... So I take it... that they werent? Wayne Robinson wrote:>It has always been > > controller.controller_name > controller.action_name > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
ah thanks... i obviously misunderstood the original post. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Wayne Robinson wrote:> And, if you want to use these within a controller just use: > controller_name > action_name > > They a instance methodsAnd how does one change the action before invocation? I used to be able to do this if some_condition @params[ ''action'' ] = some_new_action_name end but it no longer seems to work. Nor does setting action_name to a new value work. James
On Jul 7, 2005, at 7:43 AM, James Britt wrote:> Wayne Robinson wrote: >> And, if you want to use these within a controller just use: >> controller_name >> action_name >> They a instance methods > > > And how does one change the action before invocation? > > I used to be able to do this > if some_condition > @params[ ''action'' ] = some_new_action_name > end > > but it no longer seems to work. > > Nor does setting action_name to a new value work.Give this a shot: class DynamicDispatchController before_filter :choose # ... private def choose self.action_name = params[:choose] end end Best, jeremy
Jeremy Kemper wrote:> > > Give this a shot: > > class DynamicDispatchController > before_filter :choose > > # ... > > private > def choose > self.action_name = params[:choose] > end > endThanks, that was essentially what I first tried, but I used action_name, not self.action_name James