Accessing a controller with same name as shared view

1 view
Skip to first unread message

Adam Schroder

unread,
Jul 3, 2009, 4:01:05 AM7/3/09
to spar...@googlegroups.com
Hi,

If I have the default website converted to spark and type this url:

http://website.com/Error/ 

It tries to render the error view. The same goes for all views in the Shared folder.
This means i can't have a controller called ErrorController as it will not work.

Does anyone else get this issue?

Thanks.
Adam

Schotime

unread,
Jul 7, 2009, 3:14:41 AM7/7/09
to Spark View Engine Dev
Anyone else getting this issue?
Can anyone validate that this doesn't happen to them?

Louis DeJardin

unread,
Jul 7, 2009, 11:49:01 AM7/7/09
to spar...@googlegroups.com
Can't see how that would be. Maybe there's an error boing thrown? Can
you set a breakpoint in the actions of that controller to see if
they're reached?

Adam Schroder

unread,
Jul 7, 2009, 7:36:25 PM7/7/09
to spar...@googlegroups.com
Ok..i have figured some stuff out. I was getting some bad caching which was causing some issues however, in a certain situation in CreateController i return an instance of ErrorController with an action of Notfound, however the notfound view renders without the master page, somehow bypassing it. I tried this with a webforms view and master page and it works as expected.

Not sure why the Application.spark doesn't get run.
Any ideas?

Schotime

unread,
Jul 7, 2009, 7:58:05 PM7/7/09
to Spark View Engine Dev
If the view is name Notfound and then i try and access the NotFound
controller then i get no master page rendering.
If the view is named Notfound1 and then i try and access the NotFound
controller then i get a master page rendering.

On Jul 8, 9:36 am, Adam Schroder <adamschro...@gmail.com> wrote:
> Ok..i have figured some stuff out. I was getting some bad caching which was
> causing some issues however, in a certain situation in CreateController i
> return an instance of ErrorController with an action of Notfound, however
> the notfound view renders without the master page, somehow bypassing it. I
> tried this with a webforms view and master page and it works as expected.
>
> Not sure why the Application.spark doesn't get run.
> Any ideas?
>
> On Wed, Jul 8, 2009 at 1:49 AM, Louis DeJardin <louis.dejar...@gmail.com>wrote:
>
>
>
> > Can't see how that would be. Maybe there's an error boing thrown? Can
> > you set a breakpoint in the actions of that controller to see if
> > they're reached?
>

Louis DeJardin

unread,
Jul 7, 2009, 8:55:35 PM7/7/09
to spar...@googlegroups.com
Ah! I think that's your clue! There's a convention where the
controller will use a master layout of it's name before falling back
to a layout named Application.

So you can add an Account.spark file that will be the layout for all
actions on the AccountController.

But if you have a NotFoundController it'll use NotFound as the view
and again as the layout. So I think you're seeing only the result of
notfound used as the master layout.

Try adding <use master="Application"/> to the view to prevent it from
using the layout named after the error or notfound controller.



On 7/7/09, Schotime <adamsc...@gmail.com> wrote:
>

Adam Schroder

unread,
Jul 7, 2009, 9:01:27 PM7/7/09
to spar...@googlegroups.com
Thats brilliant!!!!!!!!
omg....i thought i was going insane.

New it had to be something like that.
Nothing will stop me now...touch wood...not. haha.

Will let you know when I my site goes live with Spark.

Thanks.
Adam
Reply all
Reply to author
Forward
0 new messages