Skip to content

Instantly share code, notes, and snippets.

@sanaumair
Created March 20, 2012 15:23
Show Gist options
  • Save sanaumair/2136953 to your computer and use it in GitHub Desktop.
Save sanaumair/2136953 to your computer and use it in GitHub Desktop.
def validate params
temp = self.manufacturer != params[:manufacturer]||self.country_code != params[:country_code] ||self.model != params[:model]
end
def show
query_builder = ::Factory::query_builder
api_response_hash = query_builder.get_item(params[:id], params[:item_type])
raise ActionController::RoutingError.new 'Not Found' if api_response_hash[:items].blank?
@result_item = ::Factory.create_result_item(api_response_hash['items'][0])
begin
raise unless @result_item.validate params
rescue
redirect_to :internal_server_error_errors
end
add_breadcrumb({
:link => result_items_url(:search => @search.to_hash),
:title => @result_item.breadcrumb_title,
:name => @result_item.breadcrumb_title,
})
initialize_prev_next_items unless @search.new_object
initialize_lead @result_item
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment