Using :id=>'something' vs :mid=>'something' params


#1

Is there any reason for using :id=>‘something’ instead of
:mid=>‘something’
in link_to or link_to_remote? (well other than generating a nicer link)
My tool for analysing apache logs is considering /controller/action/4 as
a
different link than /controller/action/5, so instead of counting
/controller/action it will count every variation of that parameter.
Bogdan


#2

Is there any reason for using :id=>‘something’ instead of :mid=>‘something’
in link_to or link_to_remote?

Well, if the parameter is an id, its best to call it id. That doesn’t
mean rails has to generate routes of the form /controller/action/id,
however. Just as you can add extra parts to routes in rails (eg
:controller/:action/:year/:month/:day), you could (if you really felt
you had to) change the default route in routes.rb to
:controller/:action. This will generate urls of the form
/controller/action?id=something. Even so, I’d always prefer clean
urls over a scheme like this.

My tool for analysing apache logs is considering /controller/action/4 as a
different link than /controller/action/5, so instead of counting
/controller/action it will count every variation of that parameter.

I don’t have any experience in log analysis, but surely there’s
software that can handle this common url pattern?

Tom


#3

Thanks, i didn’t think about routes.rb


#4

On 1/23/06, matthew clark removed_email_address@domain.invalid wrote:

will submit to - /controller/form_page/form_save

I’m sure my mistake is an obvious one, because this certianly isn’t desired
behavior.

Try start_form_tag({:action => “form_save”, :id => 1})

Tom


#5

I ran into the issue last night, but was in a hurry so I just made a
note to
investigate it today. When I used id for a page with a form, the submit
action was incorrect. Like this -

<%= link_to(“Form”, :action=>“form_page”, :id=>1) %>

That gets you a url like - /controller/form_page/1

then, the form start tag -
<%= start_form_tag(“form_save”) %>

will submit to - /controller/form_page/form_save

I’m sure my mistake is an obvious one, because this certianly isn’t
desired
behavior.

matt