Applying foreign key during initialize gives me a view error

Michael Wilkes wrote:

   def initialize(org_id)

      if !org_id.nil?          # Link new company to the organization logged in.          @organization_id = org_id       end

   end

You need to call super in initialize to allow ActiveRecord to do its stuff first.

Also, did you mean to set the organization_id attribute rather than an organization_id instance variable?

def initialize(org_id)    super    # Link new company to the organization logged in.    self.organization_id = org_id if org_id end