Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoice - check overlap dates #261

Merged
merged 3 commits into from
Sep 11, 2015
Merged

Conversation

yunixon
Copy link
Contributor

@yunixon yunixon commented Sep 10, 2015

No description provided.


validates :amount, numericality: { greater_than: 0,
less_than_or_equal_to: Dictionaries.money_max }
validates :currency, inclusion: { in: Dictionaries.currencies,
message: "%{value} is not a valid currency" }
validate :check_overlap_dates_for_customer, if: 'customer_name.present?'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yunixon please check this gem https://github.com/robinbortlik/validates_overlap I think it will be better to use this, instead of custom solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexanderUlitin this gem show overlaping error only on starts_at field, even if field not present


scope :ordered, -> { order('created_at DESC') }
scope :ordered, -> { order('created_at DESC') }
scope :all_except, -> (invoice) { where.not(id: invoice) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yunixon you don't use this scope, let's remove it.

AlexanderUlitin added a commit that referenced this pull request Sep 11, 2015
@AlexanderUlitin AlexanderUlitin merged commit aff30af into master Sep 11, 2015
@AlexanderUlitin AlexanderUlitin deleted the invoice-date-validation branch September 11, 2015 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants