Hi all, I''m trying to get rails up on mssql for a friend, does anyone have experience? We''re working on a Windows XP box with MSSQL 2000 (no service pak), and both rails (1.1) and MSSQL are on the same box. I''m running into a bug (I think) where activerecord is using this syntax: SELECT TOP 1 * FROM users WHERE (users.user = ''jbgnuumnbu'') However, users.user is not a valid syntax in MSSQL. Why doesn''t AR handle this? Arn''t other people using this without problems? Found the error running rake migrate. -- Matthew Beale :: mixonic@synitech.com Resume & Portfolio @ http://madhatted.com -- Posted via http://www.ruby-forum.com/.
Looks correct to me. users is the table, and user is the column. tablename.columnname is always acceptable because of possible ambiguity. @user = User.find_by_username(''jbgnuumnbu'') would return exactly what you see there. On 4/7/06, Matthew Beale <mixonic@synitech.com> wrote:> > Hi all, > > I''m trying to get rails up on mssql for a friend, does anyone have > experience? We''re working on a Windows XP box with MSSQL 2000 (no > service pak), and both rails (1.1) and MSSQL are on the same box. I''m > running into a bug (I think) where activerecord is using this syntax: > > SELECT TOP 1 * FROM users WHERE (users.user = ''jbgnuumnbu'') > > However, users.user is not a valid syntax in MSSQL. Why doesn''t AR > handle this? Arn''t other people using this without problems? > > Found the error running rake migrate. > > -- > Matthew Beale :: mixonic@synitech.com > Resume & Portfolio @ http://madhatted.com > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060407/1fb8ba7a/attachment.html
Brian Hogan wrote:> Looks correct to me. > users is the table, and user is the column. tablename.columnname is > always > acceptable because of possible ambiguity.Well it may work in find_by, yeah. The error was from the validates_as_unique, so I''ve gone and changed it to not use the table name. I''m not sure if the rest of rails uses it as well. Another frustrating point has arisen though. The rake tests uses a DBI string for the "host" argument of the mssql db dump/import tool (called scrtxfr or something). The host argument _actually_ needs to be just the host. If I change the host in database.yml, I make rails no longer connect to mssql via AR. Is anyone out there using mssql? -- Matthew Beale :: mixonic@synitech.com Resume & Portfolio @ http://madhatted.com -- Posted via http://www.ruby-forum.com/.