ruby - MySQL2: Lost connection to MySQL server during query -


i getting following error when trying use union:

actionview::template::error (mysql2::error: lost connection mysql server during query: select  `apps`.* `apps`  `verve_apps`.`status` in (1, 2) , (apps.id in (select apps.id `apps`  `apps`.`status` in (1, 2) , (app_name '%b%') union select apps.id `verve_apps` inner join taggings on taggings.taggable_id = apps.id                   inner join tags on tags.id = taggings.tag_id , taggings.taggable_type = 'app' `apps`.`status` in (1, 2) , (tags.name = 'b') order id asc)) order app_name asc limit 10 offset 0) 

app.rb

class app < activerecord::base    include activerecord::unionscope    acts_as_taggable   attr_accessor: :user_name, :age, :country, tag_list   scope :tagged_with, lambda { |tag|     {       :joins => "inner join taggings on taggings.taggable_id = user.id\                inner join tags on tags.id = taggings.tag_id , taggings.taggable_type = 'app'",       :conditions => ["tags.name = ?", tag],       :order => 'id asc'     }   }   def self.search(search)     if search       union_scope(where('name ?', "%#{search}%") ,tagged_with(search))     else       scoped     end   end end 

user_controller.rb

class usercontroller < actioncontroller::base   def index     @users = user.search(params[:search]).paginate(:per_page => per_page, :page => params[:page])   end 

database.yml

pipe_local_development: &pipe_local_development   adapter: mysql2   encoding: utf8   reconnect: true   database: app_development   pool: 5   username: root   password: 

i able run method console without problems.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -