NoMethodError in PropertiesController#search_by_area

undefined method `properties' for nil:NilClass

Extracted source (around line #38):
36
37
38
39
40
41
          
build_sort
@area = Area.from_name(params[:area_id])
@q = @area.properties.visible_on_website.price_order_high_low.search(params[:q]) if @sort == :price_high_low
@q = @area.properties.visible_on_website.price_order_low_high.search(params[:q]) if @sort == :price_low_high
@q = @area.properties.visible_on_website.availability_date_order.search(params[:q]) if @sort == :availability_date
@properties = @q.result.page(params[:page]).per(5)

Rails.root: /var/www/vhosts/ridleyproperties.com

Application Trace | Framework Trace | Full Trace
app/controllers/properties_controller.rb:38:in `search_by_area'

Request

Parameters:

{"area_id"=>"city%20centre"}

Response

Headers:

None