-
-
Save gudata/2157258 to your computer and use it in GitHub Desktop.
This file contains 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 | |
[:manufacturer, :model, :country_code].each do |field| | |
incoming_param = params[field].blank? ? '' : params[field] | |
field_value = self.send(field).blank? ? '' : self.send(field) | |
if field_value != incoming_param | |
error = Api::Errors::BadRequest.new('Bad Request it should be like manufacturer-country_code-model') | |
raise error | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment