From 0e48023e8c85320d11f610cb86cbf48955b9e204 Mon Sep 17 00:00:00 2001 From: Sean Date: Tue, 6 Oct 2015 17:17:20 +1100 Subject: [PATCH] Fix postcode_to_postcode_id. --- app/models/pv_query.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/pv_query.rb b/app/models/pv_query.rb index d5cf582..fd8f292 100644 --- a/app/models/pv_query.rb +++ b/app/models/pv_query.rb @@ -31,10 +31,10 @@ def pvo_search_params # Change postcode param to postcode_id. def postcode_to_postcode_id - postcode.id = 1234 if Rails.env == 'production' + self.postcode_id = 1234 if Rails.env == 'production' + + pcode = Postcode.where('pcode = ?', self.postcode_id).select('id').first - pcode = Postcode.where('pcode = ?', postcode.id).select('id').first - # Without this, rspec fails. self.postcode_id = pcode.id unless pcode.nil? end