Note that there are some explanatory texts on larger screens.

plurals
  1. POLegacy Schema and dynamic find (Ruby on Rails)
    primarykey
    data
    text
    <p>I'm trying to put a rails face on a legacy database. It is an old Sybase 11 database installation. I've gotten an ODBC connection working that uses unixODBC and FreeTDS to work. I'm also using the activerecord-odbc-adapter gem.</p> <p>I've had to use set_table_name and set_primary_key to make it work so far. However, none of the dynamic find_by methods work. I always get a method missing error. Also, find through association doesn't work as well with the same error. Normal finds on the models work, but I was hoping I can shorthand some of this.</p> <p>Am I SOL on this because it's a legacy DB or is there something I can do or check to make that work?</p> <p>If I can, that would save me some work writing SQL.</p> <p>Thank you.</p> <p>Edit:</p> <p>Console Output:</p> <pre><code>Person.find_by_last_name("Smith") NoMethodError: undefined method `find_by_last_name' for Person(Table doesn't exist):Class from /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1778:in `method_missing' from (irb):1 Person.find(:first, :conditions =&gt; { :last_name =&gt; "Smith" }) #&lt;Person Person_ID: &lt;redacted&gt;, Title: "Mr.", First_Name: "Aaron", Middle_Name: "Michael", Last_Name: "Smith", Suffix: nil, Preferred_Name: nil </code></pre> <p>Further Edit:</p> <p>I took a wild guess and capitalized Last_Name. That returned something. It looks like I'm going to have to do that. I still don't know how the association part would work though. That's still an issue.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload