Skip to content

Rails3.1, SQLServer adapter "find" fails with views #118

@napcs

Description

@napcs

Similar to issue #117.

When we call .find on the table, we get this in Rails 3.0.9 with sqlserver-adapter 3.0.15:

NoMethodError: undefined method `eq' for nil:NilClass

When we do this on 3.1, I'm hitting your exception:

RuntimeError: Unknown bind columns. We can account for this.
from /Users/brianhogan/.rvm/gems/ruby-1.8.7-p174@rails31/gems/activerecord-sqlserver-adapter-
    3.1.0.0/lib/active_record/connection_adapters/sqlserver/database_statements.rb:250:in `do_exec_query'

This is a legacy table with a very ugly schema so we've used a view to remap it.

class PersonRecord < ActiveRecord::Base
set_table_name "person_record"
set_primary_key "personid"
end
This seems to happen with Rails 3 as well. This is with TDS and I tested this on Rails 3.0.9 with sqlserver-adapter 3.0.15 and on Rails 3.1 with sqlserver-adapter 3.1.0.

I cannot get dbi and friends working with Rails 3 - getting all sorts of nomethod errors related to DBI::Date.

 Users/brianhogan/.rvm/gems/ruby-1.8.7-p174@app105/gems/activesupport-
 3.0.9/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `public' for class `DBI::Date'
 (NameError)

Our Rails 2 apps that work use sqlserver-adapter + odbc, so I cannot say for sure if the problem is a change made in sqlserver adapter or with FreeTDS and views.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions