Skip to content

Commit

Permalink
Finetune invoice edit a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNaessens committed Mar 18, 2024
1 parent a07ee7d commit 166e467
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 0 additions & 10 deletions app/models/note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class Note < ActiveRecord::Base

enum kind: {invoice: 0, credit: 1, income: 2, reminder: 3}

# Notes should be immutable and never changed.
#validate :force_immutable

before_create :generate_and_set_note_number
before_create :generate_and_set_pdf
before_update :generate_and_set_pdf
Expand Down Expand Up @@ -85,11 +82,4 @@ def generate_and_set_note_number
def generate_and_set_pdf
self.generated_pdf = generate_pdf
end

def force_immutable
return unless changed? && persisted?

errors.add(:base, :immutable)
reload
end
end
2 changes: 1 addition & 1 deletion app/views/notes/_form.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
= f.label :costs, class: 'label'
table.table
thead
th Datum
th Aantal
th width='60%' Omschrijving
th Bedrag
th
Expand Down

0 comments on commit 166e467

Please sign in to comment.