Resource url generation inside slices

3 views
Skip to first unread message

Chris Hoeppner

unread,
Oct 25, 2009, 9:09:20 AM10/25/09
to me...@googlegroups.com
Say I've got:

scope.resources :foobars

in the router block, how do I generate resource urls in a slice controller?

slice_url(:foobars)
slice_url(:foobar_slice_foobars)
url(:foobars)
... etc

I've tried all of the above and some more, with no success.

Chris

unread,
Oct 27, 2009, 4:00:45 AM10/27/09
to me...@googlegroups.com
Bump

Anyone?

2009/10/25 Chris Hoeppner <chris....@gmail.com>

Chris

unread,
Oct 27, 2009, 6:22:02 AM10/27/09
to me...@googlegroups.com
Well I've gotten as far as seeing that it does work from outside the slice (as in: the slice mounted for testing, generating urls for spec requests), but not from within the slice (say, in a controller). It simply seems not to know anything about a resource. Maybe it's a bug?

2009/10/27 Chris <chris....@gmail.com>

Pavel Kunc

unread,
Oct 27, 2009, 7:11:22 AM10/27/09
to merb
I think I've been bitten by this as well. The Slices are still waiting
for review for 1.1 release. There are some issues with it on 1.9.1 as
well.

I think I just used slice_url(:controller => 'xy', :action => 'xy')
manually. Please feel free to post this to the LH for slices. I'll
look at it when I'm doing the Slices review for 1.1

Pavel

On Oct 27, 10:22 am, Chris <chris.webs...@gmail.com> wrote:
> Well I've gotten as far as seeing that it does work from outside the slice
> (as in: the slice mounted for testing, generating urls for spec requests),
> but not from within the slice (say, in a controller). It simply seems not to
> know anything about a resource. Maybe it's a bug?
>
> 2009/10/27 Chris <chris.webs...@gmail.com>
>
>
>
> > Bump
>
> > Anyone?
>
> > 2009/10/25 Chris Hoeppner <chris.webs...@gmail.com>

Chris

unread,
Oct 27, 2009, 7:18:14 AM10/27/09
to me...@googlegroups.com
Thanks for your reply, Pavel.

With your way, I've got myself a "Named route not found: default" error. Manually reproducing what slice_url does in the shell works fine, but when called from within the controller, it can't find the named routes. I'll try and post something at LH.

I've been tinkering a little with manual named routes and it's not working either, but I've not tried hard enough yet to call it the same bug. It somewhat feels like I'm missing a mixin somewhere and something that should be there simply isn't.

2009/10/27 Pavel Kunc <pavel...@gmail.com>

Chris

unread,
Oct 27, 2009, 8:05:39 AM10/27/09
to me...@googlegroups.com
Definitely done testing now. Generating urls off named routes doesn't work for me at all.

2009/10/27 Chris <chris....@gmail.com>

Pavel Kunc

unread,
Oct 28, 2009, 8:32:16 AM10/28/09
to merb
Hi feel free to post to LH. One more thing to try is to put explicitly
"controller_for_slice" at the top of your controller. Its in the
application.rb but for some reason it does't inherit to the
controllers.

For lack of time I didn't manage to solve this issue. However it seems
to be valid only for 1.9.1 which I'm using.

Give it a try.

Pavel

On Oct 27, 12:05 pm, Chris <chris.webs...@gmail.com> wrote:
> Definitely done testing now. Generating urls off named routes doesn't work
> for me at all.
>
> 2009/10/27 Chris <chris.webs...@gmail.com>
>
>
>
> > Thanks for your reply, Pavel.
>
> > With your way, I've got myself a "Named route not found: default" error.
> > Manually reproducing what slice_url does in the shell works fine, but when
> > called from within the controller, it can't find the named routes. I'll try
> > and post something at LH.
>
> > I've been tinkering a little with manual named routes and it's not working
> > either, but I've not tried hard enough yet to call it the same bug. It
> > somewhat feels like I'm missing a mixin somewhere and something that should
> > be there simply isn't.
>
> > 2009/10/27 Pavel Kunc <pavel.k...@gmail.com>
Reply all
Reply to author
Forward
0 new messages