Closed nadeemyasin61 closed 11 years ago
Right, the hiring flag went away when the new jobs board was deployed as it's no longer relevant - a company's hiring state is now determined by whether it has any associated jobs, the count of which is stored in a counter cache column on the company as a way to not affect any of the other issues with load time.
I can't seem to replicate the errors you're showing me above, nor replicate them on either the live site or the staging site. It's a little wacky with different versions having been reverted and pushed various places; I can't quite trace through things. Can you point me to a link on Github?
Fine.
I can't point you to github because i had to repush the whole repository to bring it back to HEAD~3.
However, here are the steps to replicate the issue on staging.
You can also replicate the behaviour on your development server using the same steps. Just hit to localhost:3000 instead of staging url.
Here are my findings regarding code.
.tmpl expects that there should be something like this in the company object. "company['hiring']" which is missing in company's object.
Here is a screenshot as well for error reference.
Did you roll back the migrations as well before the code changes? I think there's no hiring flag left because you've reverted the code back to before the jobs board was integrated, but unless you run the reverse migrations that column won't get added back, so it won't be available on the model or in the JSON.
I just pushed a fix for this. See the recent commit.
No, i didn't reverted the migrations. I just have to re-push the whole repository to bring it back to HEAD~3. All of these three commits was mine and wanted to revert those.
BTW, the issue is fixed. I have figured it out, and is up on live.
On Fri, May 10, 2013 at 1:43 AM, Jay Zeschin notifications@github.comwrote:
Did you roll back the migrations as well before the code changes? I think there's no hiring flag left because you've reverted the code back to before the jobs board was integrated, but unless you run the reverse migrations that column won't get added back, so it won't be available on the model or in the JSON.
— Reply to this email directly or view it on GitHubhttps://github.com/menro/NewTech/issues/45#issuecomment-17688570 .
Nadeem Yasin U.E.T Lahore
@nadeemyasin61 these changes should have been managed in a branch before pushing to master. There was a lot of code that was reverted that will be hard to tease back out (e.g. the new jobs board functionality). Seems like there should be a bit more communication before force pushing reverts into the master branch. There was probably a simple way to fix the issue without a slew of reverts.
I cleaned up the history, made a few clarifying fixes, and pushed to production. Things seem to be good now, and I can't replicate the JS error, but let me know if you see anything amiss.
Jay, I deployed the latest code on production 3 days ago but started getting the following error.
"Uncaught ReferenceError: hiring is not defined"
If you take a pull and run the code locally, you will see that the issue lies in assets/home.js:250 (line) It expects to have hiring attribute in the data that we are getting in JSON response but there is no hiring attribute.
As per my findings, we do have an hiring:boolean attribute in our migration but do not have that in our production DB. The possible reason is, we added this attribute in our migration sometimes later after running the older version of this migration.
Here is an object from production db.
$ heroku run console --app newtech irb(main):002:0> Company.last Company Load (1.7ms) SELECT "companies".* FROM "companies" ORDER BY "companies"."id" DESC LIMIT 1 => #<Company id: 590, user_id: 561, employees_type_id: nil, investments_type_id: nil, city_id: 19, county_id: 9, category_id: 1, name: "Goldstone Partners", permalink: nil, enabled: nil, presented: nil, presentation_date: nil, homepage_url: "", facebook: "", twitter: "", jobs_url: "", founded_year: "2008", email_address: "annie@goldstonepartners.com", phone_number: nil, description: "", overview: nil, image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, address: "600 17th Street", zip_code: "80202", latitude: #<BigDecimal:77dfdf0,'0.39745294E2',18(18)>, longitude: #<BigDecimal:77dfd00,'-0.104990797E3',18(18)>, created_at: "2013-05-08 13:45:47", updated_at: "2013-05-08 13:45:47", jobs_count: 3> irb(main):003:0> Company.last.hiring Company Load (1.4ms) SELECT "companies".* FROM "companies" ORDER BY "companies"."id" DESC LIMIT 1 NoMethodError: undefined method'
irb(main):004:0>
hiring' for #<Company:0x000000077cfbf8> from /app/vendor/bundle/ruby/1.9.1/gems/activemodel-3.2.13/lib/active_model/attribute_methods.rb:407:in
method_missing' from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/attribute_methods.rb:149:inmethod_missing' from (irb):3 from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in
start' from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:instart' from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in
<top (required)>' from script/rails:6:inrequire' from script/rails:6:in
You can see that there is no "hiring" attribute in company's object.
Note: I have deployed an old code at production, but have latest code on staging. Here are the urls. production: http://bdnt.org/ staging: http://dry-cliffs-1240.herokuapp.com/
You can verify these findings by hitting this url as well. http://dry-cliffs-1240.herokuapp.com/api/v1/companies.json?from_year=&to_year=&tag_code=¤t_county_id=&hiring=&employee_id=&investment_id=&category_id=&company_name=
Let me know if you have any questions.