Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 将在RubyonRails3.2上使用多个数据库进行分页_Ruby On Rails_Ruby_Database_Ruby On Rails 3_Will Paginate - Fatal编程技术网

Ruby on rails 将在RubyonRails3.2上使用多个数据库进行分页

Ruby on rails 将在RubyonRails3.2上使用多个数据库进行分页,ruby-on-rails,ruby,database,ruby-on-rails-3,will-paginate,Ruby On Rails,Ruby,Database,Ruby On Rails 3,Will Paginate,我的rails应用程序连接到一个mysql数据库,但在一个单一型号的客户中,我使用不同的sql server数据库。我的应用程序工作正常,我可以使用Customer.all获取所有客户,但当我尝试添加分页时,我会出现以下错误: Mysql2::Error: Table 'mysql_database.Customers' doesn't exist: SHOW CREATE TABLE `Customers` 出于某种原因,will_paginate正在我的主数据库mysql而不是sql se

我的rails应用程序连接到一个mysql数据库,但在一个单一型号的客户中,我使用不同的sql server数据库。我的应用程序工作正常,我可以使用Customer.all获取所有客户,但当我尝试添加分页时,我会出现以下错误:

Mysql2::Error: Table 'mysql_database.Customers' doesn't exist: SHOW CREATE TABLE `Customers`
出于某种原因,will_paginate正在我的主数据库mysql而不是sql server db中搜索表

在我的CustomerController中,我有:

def索引 @customers=Customer.paginate:page=>params[:page],:order=>'name1,name2 asc', :每页=>20 回应待办事项|格式| format.html index.html.erb format.json{render:json=>@customers} 终止 终止 这是我的SQL Server模型,它连接到mssql_db

类Customer我不明白我做错了什么…

尝试在模型中使用self.per_page=10如果我将self.per_page=10放在模型中,并在控制器中保留@customers=Customer.paginate:page=>params[:page],如果我把self.per_page=10放在我的模型中,而我把@customers=Customer.paginate:page=>params[:page]放在控制器中,我认为它对解决问题没有任何帮助