2012-08-22 4 views
0

heroku에서 ruby ​​1.9.3을 사용하여 레일 3.2.8을 배포하면 지역적으로 모든 책이 결과 또는 없음으로 표시되고 heroku it 다음 오류 만 보여줍니다.rails heroku query help PGError : ERROR : 연산자가 존재하지 않습니다 : 정수 ~~ 알 수 없음

Started GET "/books/advanced_search?utf8=%E2%9C%93&title=elinor&author=&isbn=&commit=Search" for 157.253.204.87 at 2012-08-22 15:38:03 +0000 

Parameters: {"utf8"=>"✓", "title"=>"elinor", "author"=>"", "isbn"=>"", "commit"=>"Search"} 
Processing by BooksController#advanced_search as HTML 
Rendered books/advanced_search.html.erb within layouts/application (24.0ms) 
Completed 500 Internal Server Error in 25ms 

ActionView::Template::Error (PGError: ERROR: operator does not exist: integer ~~ unknown 
LINE 1: ...tle LIKE '%elinor%' and author LIKE '%%' and isbn LIKE '%%') 

HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. 

임은 문자열 제목, 어떤 이들 중 하나 또는 모두에 의해에 의해, 정수 텍스트 및 ISBN이다 작가를 통해 내 미니 카탈로그에 책을 찾기 위해 노력. Heres는

내 쿼리 :

@books = Book.paginate(
     page: params[:page], per_page: 10, 
     :conditions => [' 
        title like ? || 
        author like ? || 
        isbn like ?', 
      { :title => "%#{params[:title]}%", 
      :author => "%#{params[:author]}%", 
      :isbn => params[:isbn].to_i 
      } 
     ] 
) 

을 Heres 모델 :

class Book < ActiveRecord::Base 
    attr_accessible :author, :isbn, :title, :description 
    has_many :reviews, dependent: :destroy 
    has_many :ratings, dependent: :destroy 

    validates :author,  presence: true 
    validates :description, presence: true 
    validates :isbn,  presence: true 
    validates :title,  presence: true 


end 

는 당신의 도움에 대해 감사합니다!

답변

0

DB가 정수로 쿼리를 수행하지 않기 때문에 오류가 발생했습니다!

관련 문제