ウェブサービスを作っています。

:id => @post と :id => @post.id は違う

<% @post = Post.find(1) -%>
<%= link_to ':id が @post', :action => :index, :id => @post %>
<%= link_to ':id が @post.id', :action => :index, :id => @post.id %>

ってあったときに、この 2 つの link_to はふつうは同じで、

<a href="/home/index/1">:id が @post</a>
<a href="/home/index/1">:id が @post.id</a>

とかが出力結果なんですが、Post モデルに

class Post < ActiveRecord::Base
  def to_param
    'はい、はい、違いますよー!'
  end
end

とかあると、

<a href="/home/index/%E3%81%AF%E3%81%84%E3%80%81%E3%81%AF%E3%81%84%E3%80%81%E9%81%95%E3%81%84%E3%81%BE%E3%81%99%E3%82%88%E3%83%BC%EF%BC%81">:id が @post</a>
<a href="/home/index/1">:id が @post.id</a>

とかなります。


下を読んでもらったほうがいいです。
Tatsuya Takamura