Skip to content

Instantly share code, notes, and snippets.

@Electron-libre
Created February 9, 2011 15:54
Show Gist options
  • Save Electron-libre/818693 to your computer and use it in GitHub Desktop.
Save Electron-libre/818693 to your computer and use it in GitHub Desktop.
def integrity
if time_credit?
errors.add(:base, I18n.t(:establishment_cost_empty, :scope => [:models, :destinations, :integrity])) unless establishment_cost?
elsif establishment_cost?
errors.add(:base, I18n.t(:time_credit_empty, :scope => [:models, :destinations, :integrity])) unless time_credit?
end
end
@etaque
Copy link

etaque commented Feb 9, 2011

unless (time_credit? && cost_empty?) || !(time_credit? || cost_empty?)
field_in_error = time_credit.empt? ? :time_credit : :cost_empty
errors.add(field_in_error, I18n.t(field_in_error, :scope => ...))
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment