Closed frconil closed 10 years ago
tried with MRI ruby to no avail:
Environment:
Redmine version 2.5.0.stable.12119
Ruby version 2.1.2-p95 (2014-05-08) [x86_64-linux]
Rails version 3.2.17
Environment production
Database adapter PostgreSQL
Is your admin user listed into the group assigned to manage orders into /settings/plugin/redmine_app__space ? Even the admin needs to be.
Yes, we tried with both admin and another user added to the order admins group.
I need to check what queries are made to Postgresql since I don't have an instance of it. A 404 error is emitted whenever an exception is risen, and sometimes ActiveRecord doesn't behave the same as in MySql.
Please add the following statements to your config/environments/production.rb (or development.rb) and report the log:
config.log_path = '<some path>/production.log'
config.logger = Logger.new(config.log_path, 7, 1048576)
config.logger.level = Logger::DEBUG
Thanks
TsPermission Load (0.5ms) SELECT "ts_permissions".* FROM "ts_permissions" WHERE "ts_permissions"."is_primary" = 't' AND "ts_permissions"."order_id" = 552 ORDER BY '---
:access: :desc
'
PG::SyntaxError: ERROR: non-integer constant in ORDER BY
LINE 1: ...y" = 't' AND "ts_permissions"."order_id" = 552 ORDER BY '---
^
: SELECT "ts_permissions".* FROM "ts_permissions" WHERE "ts_permissions"."is_primary" = 't' AND "ts_permissions"."order_id" = 552 ORDER BY '---
:access: :desc
'
I guess that would explain the error.
I can edit a new order by replacing the following line:
diff /tmp/order_users_controller.rb plugins/redmine_app_timesheets/app/controllers/order_users_controller.rb
14,15c14,15
< @members = TsPermission.where(:is_primary => true, :order_id => @order.id).order(:access => :desc).map{|p| p.principal}.sort{|a,b| a.is_a?(User) ? (b.is_a?(User) ? 0 : -1) : (b.is_a?(Group) ? 0 : 1) }
< @activities = TsActivity.where(:order_id => @order).map(&:activity_id)
---
> @members = TsPermission.where(:is_primary => true, :order_id => @order.id).order('access desc').map{|p| p.principal}.sort{|a,b| a.is_a?(User) ? (b.is_a?(User) ? 0 : -1) : (b.is_a?(Group) ? 0 : 1) }
> @activities = TsActivity.where(:order_id => @order).map(&:activity_id)
Thank you.
I have to double check because the syntax order(:access: => :desc) was accepted under MySql but didn't work (no ordering seemed to happen).
Unfortunately active record has several of these incompatibilities. If nothing better, I will explicitly add a switch.
Thanks!
Francois Conil notifications@github.com ha scritto:
I can edit a new order by replacing the following line:
14 @members = TsPermission.where(:is_primary => true, :order_id => @order.id).order('access desc').map{|p| p. principal}.sort{|a,b| a.is_a?(User) ? (b.is_a?(User) ? 0 : -1) : (b.is_a?(Group) ? 0 : 1) }
instead of
14 @members = TsPermission.where(:is_primary => true, :order_id => @order.id).order(:access: => :desc).map{|p| p. principal}.sort{|a,b| a.is_a?(User) ? (b.is_a?(User) ? 0 : -1) : (b.is_a?(Group) ? 0 : 1) }
— Reply to this email directly or view it on GitHub.
Would
order('access DESC')
(with capital DESC) fail in postgresql as well?
Francois Conil notifications@github.com ha scritto:
I can edit a new order by replacing the following line:
14 @members = TsPermission.where(:is_primary => true, :order_id => @order.id).order('access desc').map{|p| p. principal}.sort{|a,b| a.is_a?(User) ? (b.is_a?(User) ? 0 : -1) : (b.is_a?(Group) ? 0 : 1) }
instead of
14 @members = TsPermission.where(:is_primary => true, :order_id => @order.id).order(:access: => :desc).map{|p| p. principal}.sort{|a,b| a.is_a?(User) ? (b.is_a?(User) ? 0 : -1) : (b.is_a?(Group) ? 0 : 1) }
— Reply to this email directly or view it on GitHub.
redmine=# SELECT "ts_permissions".* FROM "ts_permissions" WHERE "ts_permissions"."is_primary" = 't' AND "ts_permissions"."order_id" = 554 ORDER BY access DESC;
id | order_id | access | principal_id | is_primary
----+----------+--------+--------------+------------
(0 rows)
It seems to be working just fine.
We're getting the following error:
system info:
Let me know if you need more info.