On Sun, Feb 20, 2011 at 5:35 PM, T <[email protected]> wrote:

> In this case the view I want to render is not one of the routes.  I
> already have a show/edit/index view, I now need another one that is
> specialized and this may not be the last one I need.
>

If you want to link_to the way you're doing, it will need to be a route; you
can add routes other than the standard RESTful set. See the routing guide in
guides.rubyonrails.org.

Yes, you _could_ one off 'render :template => "view" if params[:id] ==
"view" ', (or something like this, in the show action) but I really would
discourage this sort of thing; your controller will become very hard to
maintain.

Phil



>
> On Feb 20, 6:18 pm, Phil Crissman <[email protected]> wrote:
> > Phil
> >
> > On Sun, Feb 20, 2011 at 3:13 PM, T <[email protected]> wrote:
> > > I have a resource 'users'.  the index page has a 'link_to' tag I
> > > created on the line item level for a specific view.  The link_to that
> > > is frustrating me in particular says:  <%= link_to 'View', :controller
> > > => 'users', :action => 'view' %>
> >
> > > What's happening is that it's going to the Users controller and
> > > attempting to execute the 'show' action (with 'view' passed in as the
> > > id).  But i am specifically requesting it to use the link_to to go to
> > > the 'view' action.  I've tried routing to another controller as well
> > > and that doesn't change it at all.
> >
> > It will be a lot easier to just use the name of the route, eg, =link_to
> > "View", view_user_path(user) (or whatever the name of the route is; you
> can
> > always find it in the output of rake routes.
> >
> >
> >
> >
> >
> > > This is a rails 2.3.8 app if that matters in evaluating my question/
> > > problem.  Any help would be really appreciated.  As an aside, I've
> > > even tried hi-jacking the 'show' action by looking for a params id =
> > > 'view' and it fails before it even gets there (so assuming the route
> > > is smart enough to expect a non-string value).
> >
> > > --
> > > 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.
>
> --
> 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.
>
>

-- 
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.

Reply via email to