Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #76 from chrismccord/master

Routing error caused by id paramter being passed record object instead of record id
  • Loading branch information...
commit a83fbc189af395da0354fa3ab04219742cebc27a 2 parents 4d33414 + 41b14fd
Neeraj Singh neerajdotname authored
7 app/helpers/admin_data/application_helper.rb
View
@@ -288,5 +288,12 @@ def get_reflection_for_column(klass, col)
klass.reflections.values.detect { |reflection| reflection.primary_key_name.to_sym == col.name.to_sym }
end
+ def record_id(record)
+ if record.respond_to?(:primary_key)
+ record.send(:primary_key)
+ else
+ record.id
+ end
+ end
end
end
2  app/views/admin_data/search/search/_listing.html.erb
View
@@ -23,7 +23,7 @@
<% columns_order(klass).each do |column| %>
<td>
<% if (column == klass.primary_key) %>
- <%= link_to(record.to_param.to_s, admin_data_path(:klass => klass.name.underscore, :id => record)) %>
+ <%= link_to(record.to_param.to_s, admin_data_path(:klass => klass.name.underscore, :id => record_id(record))) %>
<% else %>
<%=h get_value_for_column(column_native(klass, column), record) %>
<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.