开发者

Rails error "wrong number of arguments (1 for 0)"

开发者 https://www.devze.com 2023-04-09 09:02 出处:网络
I am using a scope to filter my results : @hotels = @hotels.type(params[:hotel_type]) unles开发者_StackOverflows params[:hotel_type].blank?

I am using a scope to filter my results :

@hotels = @hotels.type(params[:hotel_type]) unles开发者_StackOverflows params[:hotel_type].blank?

with

scope :type, lambda { |type|
  self.scoped.where('hotel_type_id IN ( ? )', type.join(', ')) unless type.blank?
}

And params[:hotel_type] = ["2","3"]

Anyone can help me? I think it's because it's an array but i don't know how to fix this.

Thank you


i think you cant name your scope type, i'd name it by_type

0

精彩评论

暂无评论...
验证码 换一张
取 消