From: Jasbur [email protected]
Subject: [Rails] Ambiguous clause error
<% for number in @numbers do %>
- <%= link_to number.post.title, :controller => 'post', :action => 'show', :id => post %> Ending: <%= number.post.end_date %>
<% end %>
there a more elegant way of doing this?
Based on your code snippet, you do not need any columns from the post
table in the query’s resultset. Just taking off the :include option
should do the trick.
Alternatively if that cannot be done, try using the
table_name.column_name notation. So using numbers.user_id should correct
the situation. Ie
@numbers = Number.find(:all,
:conditions => [ ‘(numbers.user_id) = :id’,
{:id => @session[‘user’].id}],
:include => :post)
Hope this helps,
Bharat