Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

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)

#5974

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

Reported by flajann · November 15th, 2010 @ 12:07 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. flajann
    flajann

    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.

    November 15th, 2010 @ 12:38 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to invalid
    • Importance changed from to Low

    November 15th, 2010 @ 02:24 PM