Hi,
I might have found bug that eats sql.

I can manualy execute this code on "Company$NCustomers" view:

UPDATE "Company$NCustomers" SET name = 'test' WHERE no_ = '100087'

But then i do that in rails, the attribute is not set:


n = User.find_by_username('ncustomer2').n_customer; n.name = 'test
chagne'; n.save

ActiveRecord::StatementInvalid: DBI::DatabaseError: Execute
    OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
      Incorrect syntax near the keyword 'WHERE'.
    HRESULT error code:0x80020009
      Wystpi wyjtek.: UPDATE "Company$NCustomers" SET  WHERE no_ =
'100087'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/abstract_adapter.rb:128:in
`log'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/sqlserver_adapter.rb:318:in
`execute'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/sqlserver_adapter.rb:301:in
`update'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1797:in
`update_without_lock'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/locking/optimistic.rb:60:in
`update_without_callbacks'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/callbacks.rb:267:in
`update_without_timestamps'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/timestamp.rb:48:in
`update'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1790:in
`create_or_update_without_callbacks'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/callbacks.rb:242:in
`create_or_update'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/base.rb:1546:in
`save_without_validation'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/validations.rb:752:in
`save_without_transactions'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/transactions.rb:129:in
`save'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
`transaction'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/transactions.rb:95:in
`transaction'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/transactions.rb:121:in
`transaction'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/transactions.rb:129:in
`save'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/associations/association_proxy.rb:123:in
`send'
  from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/associations/association_proxy.rb:123:in
`method_missing'
  from (irb):3>>


Any ideas why it rails might produce wrong sql statement here?
-- 
Posted via http://www.ruby-forum.com/.