DEFRA / ruby-services-team

Guides, info and issue management for the Ruby Services team
Other
1 stars 3 forks source link

Add hooks to `BaseForm` #59

Closed cintamani closed 4 years ago

cintamani commented 5 years ago

Given: https://github.com/DEFRA/waste-exemptions-engine/pull/256/files#diff-96eeb9eac79f0a4cb727474526cce6a9R7 I was thinking that we should start having some before_initialize method. Initially, it can just be that we add this to the BaseForm:

def initialize(registration)
  ... do its stuff  ....
  after_initialize(registration)
end
....
private 

def after_initialize(registration)
  # do nothing
end

And then in this child classes, we can just implement

def after_initialize(registration)
  # Do extra stuff
end

when needed

Cruikshanks commented 4 years ago

This is now done