Ruby on Rails: undefined method for self action in model? -


i'm getting undefined method text_search, have method in model, doing wrong?

searches_controller.rb

class searchescontroller < applicationcontroller   def index     @lists = list.text_search(params[:query])   end end 

search.rb

class search < activerecord::base   def self.text_search(query)     if query.present?       where("name @@ :q or description @@ :q", q: query)     else       scoped     end   end end 

however, i'm still getting undefined method. have ideas?

it should search not list

@lists = search.text_search(params[:query]) 

because using class search in search.rb


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -