Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion enough theory, let's fix some bugs!
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Wyatt Greene  
View profile   Translate to Translated (View Original)
 More options Jun 27 2012, 9:41 am
From: Wyatt Greene <techifer...@gmail.com>
Date: Wed, 27 Jun 2012 09:41:56 -0400
Local: Wed, Jun 27 2012 9:41 am
Subject: Re: [boston.rb] enough theory, let's fix some bugs!

If I want SEO-friendly URLs, I use https://github.com/norman/friendly_id

On Jun 27, 2012, at 9:13 AM, Denis Haskin wrote:

> Bingo!  user.rb has

>   def to_param
>     login
>   end

> removing that makes it work.  I had started to suspect that, as I was just starting to work around by hard-coding "/users/#{current_user.to_param}/orders" (oh the horror, but I didn't want to stay stuck on this forever).

> I'm not sure I understand why that broke things.  Can someone explain? (I know, I should work it out myself but I can't get to that until this evening and I'm impatient ;-) ).

> Also, what is the current school of thought?  People used to want to use to_param to make "SEO-friendly" URLs; I remember it causing me a lot of grief several years ago.

> Thanks!

> --
> Denis Haskin
> cell: 781-258-7414

> On Wed, Jun 27, 2012 at 8:25 AM, Daniel Choi <dhc...@gmail.com> wrote:
> On Wed, Jun 27, 2012 at 07:41 AM, Denis Haskin <de...@constantorbit.com> wrote:

> > and so I have the expected named route user_orders_path(@user).  It works
> > just fine if the user has orders, but if the user has no orders, trying to
> > render the route gives the following error:

> >     ActionController::RoutingError (No route matches
> > {:controller=>"orders",
> >     :user_id=>#<User id: 472, account_id: nil, first_name: "Denis",
> > last_name:
> >     "Haskin", ...etc... , last_sign_in_ip: "127.0.0.1">})

> In rails c, what does `User.find(472).to_param` return?

> You can also test if the routes are being drawn correctly in `rails c`

> In rails c:

>  u = User.find(472)  # <= user with no orders
>  app.user_orders_path(u)
>  # see what you get
>  u.to_param
>  # see what you get

>  # repeat above with a user that doesn't trigger this bug

> --
> You received this message because you are subscribed to the Boston Ruby Group mailing list
> To post to this group, send email to boston-rubygroup@googlegroups.com
> To unsubscribe from this group, send email to boston-rubygroup-unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/boston-rubygroup

> --
> You received this message because you are subscribed to the Boston Ruby Group mailing list
> To post to this group, send email to boston-rubygroup@googlegroups.com
> To unsubscribe from this group, send email to boston-rubygroup-unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/boston-rubygroup


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.