rails-sqlserver / activerecord-sqlserver-adapter

SQL Server Adapter For Rails
MIT License
972 stars 559 forks source link

Table name instead order clauses #76

Closed henrymazza closed 13 years ago

henrymazza commented 13 years ago

Somehow unique_orders(rowtable_order_clauses) is returning the table name instead the order clauses.

Devolucao.count 

Generates:

SELECT COUNT([count]) AS [count_id] FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [tbl123_devolucao_cliente]) AS [__rn], 1 AS [count] FROM [tbl123_devolucao_cliente] WHERE ([tbl123_devolucao_cliente].[SYSTEM_DELETED_VALUE] = 0) AND ([tbl123_devolucao_cliente].[T123_devolucao_de_vale_diferenca] = 0) ) AS [__rnt] WHERE [__rnt].[__rn] > 0

See? The part

(ORDER BY [tbl123_devolucao_cliente])

causes the error Invalid column name. I'm using a legacy database through set_table_name, set_primary_key, etc. Also TinyTDS along with the 3.0.7 version and 2005 MS SQL Server. I was able to accomplish this project using the arel2 branch.

metaskills commented 13 years ago

The arel2 branch was experimental. Please update to v3.0.8 of the adapter which supports ActiveRecord v3.0.3 and ARel v2.0.7. Closing this ticket.

henrymazza commented 13 years ago

Great! Thanx!