For some reason rubocop is choking on this code I have in my model to properly address accepts_nested_attributes_for
to work like find or create. When I tried to remove the self
calls it blows up. At this point I am deferring to experts before I shut that darn cop off. Thoughts?
class Job < ActiveRecord::Base
belongs_to :company
before_validation :find_company
accepts_nested_attributes_for :company
private
def find_company
if self.company
self.company = Company.where(email: self.company.email).first_or_initialize
end
end
end