views:

9

answers:

0

Is installed this ruby on rails plugin for sortable paginated tables, but can't get it to work on related objects. git://github.com/kovacs/sortable.git http://javathehutt.blogspot.com/2009/06 … rails.html

In the example given based on the User class, using the associated Role class, there is a :table_heading of ['Role', 'role'], a :sort_map 'role' => ['roles.role'] and :include_relations => [:role]

When I try something similar, the 'role' table heading is trying to show the object itself, which shows up as "#" values. Assuming user.role returns a role object, and we want the 'role attribute on that object, I don't see how this is expected to work unless you put in a :table_heading of ['Role', 'role.role']. This does display the value of the role attribute for me, but produces an error on each user object where user.role is nil, and I'm not sure where to modify the code to avoid user.role.role when the association is nil.

Am I missing something fundamental here (quite possible), or is there a more established plugin available?