Commit a8059a3aca6ea77e522bef0df2499df1ee8b9cce

Authored by Luke Baker
1 parent dee0ba1b

modify visitor find_or_create_by

it seems that when specifying the user scope in the front that ruby 1.9.3 will query all visitors for that user instead of limiting by the visitor_identifier. By moving where we specify the user we get the query that we want in both 1.8.7 and 1.9.3
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/question.rb
... ... @@ -183,7 +183,7 @@ class Question < ActiveRecord::Base
183 183 if params[:with_prompt]
184 184  
185 185 if params[:with_appearance] && visitor_identifier.present?
186   - visitor = current_user.visitors.find_or_create_by_identifier(visitor_identifier)
  186 + visitor = Visitor.find_or_create_by_identifier_and_site_id(visitor_identifier, current_user.id)
187 187  
188 188 last_appearance = get_first_unanswered_appearance(visitor)
189 189  
... ...