#15

Solved

Doesn't honor table name or PK overrides

Reported by Jim Morris on Ajax Scaffold · 22/04/2006 00:50:50

Assigned to:
Nobody
Priority:
Normal
Status:
Solved
Category:
None
Version:
3.1.1

the controller generates the following line for sorting

@sort_by = @sort_sql.nil? ? “users.id asc” : @sort_sql + " " + current_sort_direction(params)

However there are table name overrides of

ActiveRecord::Base.table_name_suffix = “_tbl”
ActiveRecord::Base.pluralize_table_names = false
ActiveRecord::Base.primary_key_prefix_type= :table_name_with_underscore

so the table name is user_tbl and the primary key is user_id. So the above generated line needs to be modified to…

@sort_by = @sort_sql.nil? ? “user_tbl.user_id asc” : @sort_sql + " " + current_sort_direction(params)

or simply
@sort_by = @sort_sql.nil? ? “.user_id asc” : @sort_sql + " " + current_sort_direction(params)

to work

Attachments Upload

No attachment has been uploaded, yet.


Loading comments...