Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for mssql with jruby/activerecord-jdbc-adapter #236

Merged
merged 1 commit into from
Apr 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix for mssql with jruby/activerecord-jdbc-adapter
Fix for the following error with mssql with jruby/activerecord-jdbc-adapter:
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: No column was specified for column 3 of 't'.: SELECT t.* FROM ( SELECT ROW_NUMBER() OVER(ORDER BY MIN(users.id)) AS _row_num, [users].[lft], COUNT([users].[lft]) FROM [users]  GROUP BY [users].[lft] HAVING COUNT([users].[lft]) > 1 ) AS t WHERE t._row_num BETWEEN 1 AND 1
  • Loading branch information
soemo committed Jan 28, 2014
commit 91f7d3048ed62b6d0a645cb3facfce92cba7bec1
2 changes: 1 addition & 1 deletion lib/awesome_nested_set/model/validatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def left_and_rights_valid?
def no_duplicates_for_columns?
[quoted_left_column_full_name, quoted_right_column_full_name].all? do |column|
# No duplicates
select("#{scope_string}#{column}, COUNT(#{column})").
select("#{scope_string}#{column}, COUNT(#{column}) as _count").
group("#{scope_string}#{column}").
having("COUNT(#{column}) > 1").
first.nil?
Expand Down