As far as I know, this is what :as is for. I've never seen :class_name used
within the context of routes, but it may be an available option I don't know
about.

On 24 May 2010 08:27, Jury <[email protected]> wrote:

> Hi Ryan,
>
> I specify :class_name in the router so that I can generate URLs that
> look like:
>
> /thread
> /thread/new
> /thread/5/edit
> etc
>
> while having the requests dispatched to the ForumThreadController
> (forum_thread_controller.rb).
>
> Unfortunately, due to namespace constraints, I can't just call the
> controller ThreadController (or at least the associated generators
> yelled at me when I tried).
>
> -J
>
> On May 23, 3:20 pm, Ryan Bigg <[email protected]> wrote:
> > I don't get why you're doing :class_name in the routes. I think the :as
> > should be there. :class_name is more an ARec thing.
> >
> > On 24 May 2010 08:16, Michael Koziarski <[email protected]> wrote:
> >
> >
> >
> >
> >
> > > > Shouldn't form_for be keying off of ":as => :thread" and using
> > > > threads_path/thread_path instead of forum_threads_path/
> > > > forum_thread_path ?
> >
> > > No, not as currently designed and implemented.  The mapping from
> > > instance to route helper name is done without consulting the routing
> > > definitions at all, it's driven entirely off the class name and a few
> > > simple conventions.  This has the downside that you get the errors
> > > that you're seeing now.  But there's also the upside that you can have
> > > those helpers call routes defined in ways other than resources.  e.g.
> > > manually connecting posts to a URL then using form_for @post.
> >
> > > --
> > > Cheers
> >
> > > Koz
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Ruby on Rails: Core" group.
> > > To post to this group, send email to [email protected]
> .
> > > To unsubscribe from this group, send email to
> > > [email protected]<rubyonrails-core%[email protected]><rubyonrails-core%2Bunsubscrib
> [email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-core?hl=en.
> >
> > --
> > Ryan Bigg / Radar
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<rubyonrails-core%[email protected]>
> .
> > For more options, visit this group athttp://
> groups.google.com/group/rubyonrails-core?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-core%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>


-- 
Ryan Bigg / Radar

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en.

Reply via email to