Sebastien
Sebastien

Reputation: 6660

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

I am using a scope to filter my results :

@hotels = @hotels.type(params[:hotel_type]) unless 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

Upvotes: 0

Views: 1075

Answers (1)

Marian Theisen
Marian Theisen

Reputation: 6354

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

Upvotes: 4

Related Questions