Forum: Ruby on Rails sql server freetds/odbc question

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.
7a966bb1534f0ea863bc9ffe65ae449f?d=identicon&s=25 Jamie Orchard-hays (jamieorc)
on 2006-01-10 05:09
(Received via mailing list)
I'm having an error from Linux via freeTDS/ODBC to SQL Server with
cod that runs fine against SQLite and MySQL. Here's the code:

def find_recipes_for_workorder_by_id
     @recipe_pages, @recipes = paginate_with_sort :recipes, :per_page
=> 10, \
                    :conditions => ["recipe.workorder_id = ?", params
[:workorder]]
     render :template => 'recipe/list'
end

(I've included the custom sorting code at bottom of message.)

Here's the top of the error:

DBI::DatabaseError ( (8156) [unixODBC][FreeTDS][SQL Server]The column
'name' was specified multiple times for 'tally'.):
     /usr/lib/site_ruby/1.8/DBD/ODBC/ODBC.rb:168:in `execute'
     /usr/lib/site_ruby/1.8/dbi/dbi.rb:640:in `execute'
     /usr/lib/site_ruby/1.8/dbi/dbi.rb:671:in `select_all'
     /vendor/rails/activerecord/lib/active_record/connection_adapters/
sqlserver_adapter.rb:354:in `add_limit_offset!'
     /vendor/rails/activerecord/lib/active_record/base.rb:931:in
`add_limit!'
     /vendor/rails/activerecord/lib/active_record/base.rb:924:in
`construct_finder_sql'


Any help appreciated!

Jamie


------
class ActionController::Base
   def paginate_with_sort(collection_id, options={})
     @params[:sort_direction] ||= '-1'
     asc_desc = {'1' => "asc", '-1' => "desc"}
     options[:order] = "#{@params[:sort_by]} #{asc_desc[@params
[:sort_direction]]}" if @params[:sort_by]
     @params[:sort_direction] = @params[:sort_direction].to_i * (-1)
     paginate collection_id, options
   end
end
7a966bb1534f0ea863bc9ffe65ae449f?d=identicon&s=25 Jamie Orchard-hays (jamieorc)
on 2006-01-10 05:18
(Received via mailing list)
Don't bother! That code works! I had run "rake deploy" which appeared
to succeed, but actually hadn't.

Jamie
This topic is locked and can not be replied to.