This project is archived and is in readonly mode.
link_to() fails if underlying db record does not have an "id" field (Rails 3.0.1, Ruby 1.9.2)
Reported by flajann | November 15th, 2010 @ 12:07 PM
link_to() fails with:
No route matches {:action=>"edit", :controller=>"agents", :id=>#}
Even though set_primary_key is defined:
class Agent < ActiveRecord::Base
set_primary_key = 'a_id' end
Workaround: one can set id prior to calling and all will work:
agent.id = agent.a_id
link_to 'Edit', edit_agent_path(@agent)
This is with Rails 3.0.1, Ruby 1.9.2
Comments and changes to this ticket
-
flajann November 15th, 2010 @ 12:38 PM
This is a non-issue. Please ignore this ticket.
The error was on my part doing
set_primary_key = 'a_id'
When it should've been
set_primary_key 'a_id'
I didn't need the '=' sign, and the parser didn't complain about it -- probably treated it as a regular assignment.
-
Rohit Arondekar November 15th, 2010 @ 02:24 PM
- State changed from new to invalid
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>