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

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

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

Thanks, i didn’t think about routes.rb

On 1/23/06, matthew clark [email protected] 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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs