civictechdc / districthousing

District Housing lets caseworkers help clients apply for Section 8 housing by automatically filling out multiple PDF applications using one online form.
http://codefordc.github.io/districthousing/
MIT License
40 stars 64 forks source link

Error when attempting to download the pdf from the demo #329

Closed kevko closed 9 years ago

kevko commented 9 years ago

Getting the following message. I do not know if it's confined to the demo or not.

NoMethodError in HousingFormsController#download undefined method `contact_type' for #Contact:0x0000000859cf60 Extracted source (around line #78):

def download @applicant.housing_forms << @housing_form @applicant.save filled_file = OutputPDF.new(@housing_form, @applicant).to_file download_filename = "#{@applicant}-#{@housing_form.name}.pdf" download_filename = Slugify.slugify(download_filename)

Rails.root: /home/jrunning/districthousing Application Trace | Framework Trace | Full Trace

app/controllers/housing_forms_controller.rb:78:in `download'

Request

Parameters:

{"id"=>"18152"}

Toggle session dump Toggle env dump Response

Headers:

None

meiao commented 9 years ago

Last meeting one commit added a new field to Contact. So every existing database needs to be migrated.

just run rake db:migrate

jrunningen commented 9 years ago

It needed a re-seed, too. The sample user was missing, not sure why. The sample user is what gets used to show fillable field statistics if there's no current applicant.

$ rails c
Loading production environment (Rails 4.1.1)
2.1.2 :001 > User.find_by(role: User::USER_ROLES[:sample]).applicants.first
 => nil

It gets created in db/seeds.rb:

Applicant.destroy_all
Person.destroy_all
User.destroy_all
Residence.destroy_all
Address.destroy_all
Income.destroy_all
Employment.destroy_all
CriminalHistory.destroy_all
Contact.destroy_all

sample_user = User.create(
  :email => "sampleuser@districthousing.org",
  :password => "password"
)
sample_user.role = User::USER_ROLES[:sample]
sample_user.save!

a = ApplicantFactory.make_a_sample_applicant(sample_user)
a.identity.first_name = "Sample"
a.identity.middle_name = "Testing"
a.identity.last_name = "Person"
a.save