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?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/285a41ae7cc640a625b509e15ca524fc%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment