Forum: Ruby on Rails Using Existing Database - Model has no column

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
134d195f46046e83bcde0af3873d613f?d=identicon&s=25 Rad Ical (rad1cal)
on 2016-04-05 09:29
I'm developing a new rails project using an existing SQL SERVER 2008
database.

rails 4.1.2
tiny_tds
activerecord-sqlserver-adapater 4.1.2

my model is

class IpProject < ActiveRecord::Base
  self.table_name = 'IP_Projects'
  self.primary_key = "ProjectID"
end

I know I can connect to the database because I get a result when I try
to get count of all data.

IpProject.count

but I can't retrieve data as it has no column

IpProject.columns returns []


I get results using ActiveRecords
ActiveRecord::Base.connection.exec_query("SELECT * FROM ip_projects")

I also get result using tiny_tds
client.execute("SELECT * FROM ip_projects")

Also, getting result using the model this way
IpProject.connection.exec_query("SELECT * FROM ip_projects").first


but using the model
IpProject.first
returns #<IpProject:0xab01c98> which has no columns or data

Am I missing something here?
This topic is locked and can not be replied to.