Ruby on Rails accessing SQL Server Views

36 views
Skip to first unread message

Shinon Chan

unread,
Oct 29, 2015, 2:46:48 PM10/29/15
to Rails SQLServer Adapter

I am using Ruby on Rails with ting_tds and activerecord-sqlserver-adapter to access a MS SQL Server database.

I have all the tables set up but I am not able to set up the Views.

There is a view called dbo.vwJobShipTo.

In my model, I put the following:

class vwJobShipTo < ActiveRecord::Base

  self.table_name = "vwJobShipTo"
  self.primary_key = "JobShipToId"


end

I am getting "NameError: undefined local variable or method `vwJobShipTo' for main:Object"

Any idea what I am missing? Any help / advice is greatly appreciated. Thanks a lot in advance.

Klaus Kohlbauer

unread,
Oct 29, 2015, 3:27:17 PM10/29/15
to rails-sqlse...@googlegroups.com

You are sure the table name is "vwJobShipTo" not "vwJobShipTos"?

br
klaus kohlbauer

 

 

Ursprüngliche Nachricht

--
You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-sqlserver-a...@googlegroups.com.
To post to this group, send email to rails-sqlse...@googlegroups.com.
Visit this group at http://groups.google.com/group/rails-sqlserver-adapter.
For more options, visit https://groups.google.com/d/optout.


infosense gmbh, Donnersbergerstr. 9, D-80634 München
Telefon: 089 / 12 11 35 59
Internet: http://www.infosense.de
Registergericht: Amtsgericht München
Registernummer: HRB 175784
Vertretungsberechtiger Geschäftsführer: Dipl. Kfm. Klaus Kohlbauer

Diese Information ist vertraulich und ausschließlich für die adressierte Person bestimmt. Sollten Sie diese Nachricht irrtümlich erhalten haben, bitten wir Sie, sich mit dem Absender in Verbindung zu setzen und das Material (die Mail nebst etwaigen Anhängen) von Ihrem Computer zu löschen, ohne eine Kopie davon zurückzubehalten.

This message is confidential and only intended for the recipient. Should you not be the intended recipient you are kindly asked to advise the sender immediately by reply e-mail and delete this message and all attachments without keeping a copy.


André Lima

unread,
Oct 30, 2015, 6:41:03 AM10/30/15
to rails-sqlse...@googlegroups.com
Friend,

In ruby class name must necessarily start with a capital letter.


Class VwJobShipTo

try it ...

--
You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-sqlserver-a...@googlegroups.com.
To post to this group, send email to rails-sqlse...@googlegroups.com.
Visit this group at http://groups.google.com/group/rails-sqlserver-adapter.
For more options, visit https://groups.google.com/d/optout.



--
Atenciosamente,

André Lima
Reply all
Reply to author
Forward
0 new messages