Wednesday, August 25, 2010

Re: Router::connect() not behaving as expected in 1.3?

I expected that /blog/ would route to the news_articles controller
(index action) like a call to /blog/index would do. This is the way
it worked on 1.2. Now, on 1.3, a request for /blog/ looks for the
blog controller.

Is there any way to combine the two Router::connect()'s into one?

To answer your question, I believe I am only specifying a default
action if none is provided.


On Aug 25, 1:25 pm, cricket <zijn.digi...@gmail.com> wrote:
> On Wed, Aug 25, 2010 at 9:05 AM, SacoDesign <sign...@sacodesign.com> wrote:
> > Hello,
>
> > I'm upgrading my app from 1.2 to 1.3.  I have several custom routes
> > setup like so:
> > Router::connect('/blog/:action/*',
> > array('controller'=>'news_articles', 'action'=>'index'));
>
> > This works fine, except for when the url is only /blog/.  In that case
> > I get a "cannot find blog controller" error.  Is this by design, or a
> > bug?
>
> > I can get it working by adding another route for:
>
> > Router::connect('/blog', array('controller'=>'news_articles',
> > 'action'=>'index'));
>
> > but that seems wrong.
>
> It looks correct to me. In the first route, you're saying, "/blog,
> plus something, and maybe something else." Obviously, "/blog" alone
> doesn't match.
>
> But why are you directing all requests to the one action?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: