-
-
Save gudata/2137074 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def validate params | |
| raise OURERROR if !(self.manufacturer == params[:manufacturer] and self.country_code and params[:country_code] and self.model == params[:model]) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]) | |
| @result_item.validate params | |
| 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 | |
| rescue OURERROR | |
| redirect_to :internal_server_error_errors | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OURERROR check models/api/errors and make your own.