0

I am using the method for linking to the project. Below the code is there

project = Project.new
project.id = value["id"]
project.name = value["project_name"]  
<td width="20%"  class="left"><%= link_to_project(project) %></td>

ERROR

 No route matches {:action=>"show", :controller=>"projects", :id=>#<Project id: 2343, name: " TESTING", description: nil, homepage: "", is_public: false, parent_id: nil, created_on: nil, updated_on: nil, identifier: nil, status: 1, lft: nil, rgt: nil, inherit_members: false, product_backlog_id: nil, default_version_id: nil>} missing required keys: [:id]

I got this error its not working. I dont know how to solve this. But rails 3.2 its working fine.

Vikiesakki
  • 31
  • 1
  • 2
  • 8

3 Answers3

0

This would work in Rails . But no longer works as of activerecord 3.2.11which is what Rails 4 depend on. If you like to know more go through this discussion.

Community
  • 1
  • 1
raj
  • 5,989
  • 7
  • 30
  • 62
0

Hi i finally i got the solution for that

We have to pass id as parameter like this

link_to_project(project,{:id=>project.id})
Vikiesakki
  • 31
  • 1
  • 2
  • 8
0

I think what you are looking for is this:

link_to(project.name, project)

or, more explicitly, this:

link_to(project.name, project_path(project))

There is more info about this in Rails Routing from the Outside In.

Karl Wilbur
  • 5,898
  • 3
  • 44
  • 54