```ruby
class JobApplication < ActiveRecord::Base
  belongs_to :posting
  after_initialize :set_applied_date

  validates :date_sent, presence: true

  private
    def set_applied_date
      self.date_sent = Date.today if self.date_sent.blank?
    end
end
```

Check for existance of posting
user
```ruby
class JobApplication < ActiveRecord::Base
  belongs_to :posting
  after_initialize :set_applied_date

  validates :date_sent, presence: true
  validates :posting, presence: true

  private
    def set_applied_date
      self.date_sent = Date.today if self.date_sent.blank?
    end
end
```
assistant