daitss / core

DAITSS: Dark Archive In The Sunshine State
GNU General Public License v3.0
9 stars 2 forks source link

undefined method `id' for nil:NilClass #762

Closed szanati closed 10 years ago

szanati commented 10 years ago

I get the following error message when I either click on the "request" tab or clicking on certain packages such as EBAEVUDXM_ZIYHPF from March 30, 2012. I can do a search for that package and it comes up but when you click on the ieid you get:

undefined method `id' for nil:NilClass

I did a quick search for a April 20, 2012 and May 7, 2012 and found packages with the same error.

szanati commented 10 years ago

I also did a quick search from the rest of the months from 2012 and found packages with the same error. June 5 2012 July 5, 2012 August 7, 2012 Sept 06, 2012 Oct 5, 2012 Nov 6, 2012 Dec 6, 2012

I also found when I do a search 08/05/2012 - 08/08/2012 using the gui, I get packages from Aug 2012 but also Dec 4, 2013, Dec 18, 2013 and Dec 19, 2013. Some of those from Dec 2013 also had the same error. I also found packages from Dec 2013 in the other searches above from 2012.

cchou commented 10 years ago

It appears this error occurs for those packages that are associated with events whose agents have been marked as deleted. For example, childree was the agent that submitted the package, hence a submit event was created for the package indicating the 'childree' as the agent. However, agent childree was marked as deleted in January 2014. After that, the event cannot retrieve the associated agent id.

As the database still have the record of 'childree' as the agent id, it appears the issue may lie in the use of ParanoidDateTime, http://datamapper.org/docs/misc.html, datatype for the 'deleted_at' field in the agent model.

The same error has been reproduced on our test server, see https://core.ripple.fcla.edu/package/EQPYY9H2M_ZG4SLY

One solution is to change the datatype from the ParanoidDateTime to regular DateTime. When I do so on ripple, the package can then be displayed. However, we need to evaluate and make sure we don't break any existing scheme if we change the datatype for the 'deleted_at' field.

cchou commented 10 years ago

According to #24, ParanoidDateTime doesn't work properly with STI.

jonpitts commented 10 years ago

The fix appears to resolve this issue.