menro / NewTech

New Tech Colorado Website
12 stars 8 forks source link

Issue with Ruby version #46

Closed nadeemyasin61 closed 11 years ago

nadeemyasin61 commented 11 years ago

Paul, I see that you have updated the ruby version from 1.9.2 to 1.9.3. It has potentially started introducing some isses, not sure if exactly this is the reason but its a worth to take a look.

If you hit the following URL, there is an error. Going to paste that error as well.

http://bdnt.org/api/v1/companies.json?from_year=&to_year=&tag_code=&current_county_id=&hiring=&employee_id=&investment_id=&category_id=&company_name=

Heroku Error Logs:

2013-05-08T18:18:08.395826+00:00 app[web.1]: 2013-05-08T18:18:08.395826+00:00 app[web.1]: ActionView::Template::Error (undefined method >' for nil:NilClass): 2013-05-08T18:18:08.395826+00:00 app[web.1]: 1: collection @companies, :object_root => false 2013-05-08T18:18:08.395826+00:00 app[web.1]: 2: 2013-05-08T18:18:08.395826+00:00 app[web.1]: 3: attributes :name, 2013-05-08T18:18:08.395826+00:00 app[web.1]: 4: :homepage_url, 2013-05-08T18:18:08.395826+00:00 app[web.1]: app/models/company.rb:116:inis_hiring?' 2013-05-08T18:18:08.395826+00:00 app[web.1]: app/views/api/companies.json.rabl:1:in `_app_views_api_companies_json_rabl__1750587841216810918_59300780'

Probably, the syntax should be as per 1.9.3 convention

collection @companies, object_root: false

However, if you hit the same URL at staging, there isn't any error and i am using 1.9.2 at staging. http://dry-cliffs-1240.herokuapp.com/api/v1/companies.json?from_year=&to_year=&tag_code=&current_county_id=&hiring=&employee_id=&investment_id=&category_id=&company_name=

Let me know if you have any questions.

jayzes commented 11 years ago

I don't think this is a Ruby version / syntax issue - did you migrate to get the jobs_count column in place on https://github.com/menro/NewTech/blob/2a12051d2e74712cd17a48774a0a255502a6603a/app/models/company.rb#L116? Migration is at https://github.com/menro/NewTech/blob/2a12051d2e74712cd17a48774a0a255502a6603a/db/migrate/20130409151936_add_jobs_count_to_companies.rb.

Anyway, that's returning nil right now which is causing this error.

paullryan commented 11 years ago

I actually did not upgrade from 1.9.2 it had been done before I got on the code base. My change d1540a016ae9f26295df381a10815543c2f76b3f is just to start using the new syntax for defining the version for rvm (moving away from .rvmc to .ruby-version and .ruby-gemset). @jayzes do you believe this issue is caused by the migration your talking about or do you think I should take an action on the versions. I'm not sure I know enough about this part to make a complete assessment at this point (part of why I want to create the automated test suite).

nadeemyasin61 commented 11 years ago

ok fine @xmltechgeek . Can you try to replicate this issue on local or on production.? You will see this error in Chrome Console or firebug.

@jayzes Yes, i did migrate the database. Both at local and at production. I dont have this error on local server but only have it on production. Here is my console's stuff (just to verify) 1.9.2p320 :003 > Company.last.jobs_count Company Load (0.3ms) SELECT companies.* FROM companies ORDER BY companies.id DESC LIMIT 1 => 0 1.9.2p320 :004 >

jayzes commented 11 years ago

Tested and worked with the same set of fixes as in #45. I did need to make a change in 05250898676bddbf76b3c3b5249aadaebe8617b4 to have rbenv work properly as it needs a patch release specified, but everything else seems to be good to go.

paullryan commented 11 years ago

Hrm, the other worked for me, but glad to hear it working. Sorry for any confusion I might have caused.

jayzes commented 11 years ago

No worries at all. Out of curiosity, do you use rvm or rbenv?

paullryan commented 11 years ago

rvm, which is probably why it didn't work for you, however I believe the .rvmrc wasn't working for you at all and you would have had to switch manually, which is why I moved to the .ruby-version file in the first place :)

paullryan commented 11 years ago

Oh and the switch to this convention for the ruby manager came from https://gist.github.com/fnichol/1912050.

jayzes commented 11 years ago

Totally - I use 1.9.3 by default so I sometimes forget about version switching. Good to have it in there though. Thanks!