resources :addresses
resources :mailing_addresses, :controller => 'addresses' <===== this is
here confuses me, why not have another controller?
this will generate 7 restful action to a controller that has
already 7 restful action
but anyway it should be like this in you routes
:requirements => { :context_type => 'addresses'}
and then in you controller check context_type == "addresses"
On Fri, Sep 10, 2010 at 6:25 AM, Anubhaw Prakash <[email protected]>wrote:
> Robert Pankowecki wrote:
> > Is there any easy way of using something like current_page? method
> > from ActionView::Helpers::UrlHelper inside controller ?
> > I have routing like:
> > resources :addresses
> > resources :mailing_addresses, :controller => 'addresses'
> >
> > And I would like to do a check in my controller that would look like
> > this:
> >
> > class AddressesController
> >
> > def index
> > if current_page?(live_addresses_path)
> > # ... logic goes here
> > elsif current_page?(addresses_path)
> > # ... logic goes here
> > end
> > end
> >
> > end
> >
> > What's the easiest way of achieving it ?
> >
> > Robert Pankowecki
>
> Hi Robert,
> I think what you can check is params[:controller] and params[:action].
> This would give you the current location in your app.
>
> Thanks,
> Anubhaw
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.