Skip to content

Hitting "NoMethodError" for find_by_<x> with a view as a table. #117

@napcs

Description

@napcs

We've had a SQLServer view we've used with this adapter for several years now. With my tests this morning, we can retrieve data with things like .first and .last, but none of the dynamic finders like

find_by_username

and others fail to work - we get "method not found" errors.

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. 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