joaomdmoura / gioco

A gamification gem to Ruby on Rails applications
305 stars 36 forks source link

Gioco::Core.sync_resource_by_points failing #60

Closed diego- closed 10 years ago

diego- commented 11 years ago

Gioco::Core.sync_resource_by_points(self, new_pontuation, kind)

returns:

ActiveRecord::UnknownAttributeError at / unknown attribute: user_id

some notes: this only fails when the point count triggers a new badge creation. otherwise it works... Running rails 3.2.13

joaomdmoura commented 10 years ago

I'll take a closer look at this and answer you asap.

thelastinuit commented 10 years ago

Did you find what's going on? I had v1.0.1 and everything was all right. After I updated it to 1.1.1 I'm getting a similar error: NameError (uninitialized constant Gioco::Core::TYPES): which I'm getting when Gioco::Core.sync_resource_by_points(self, new_pontuation, kind) is called in user.rb

thelastinuit commented 10 years ago

Yeah. Now I'm sure it's the new version, 1.1.1 I just changed gem in production mode and everything's running smoooooooothly

joaomdmoura commented 10 years ago

Sorry, I've been off for a while, but I'm back now :) And looking into this :+1:

diego- commented 10 years ago

Hi all, I managed to get this working after some playing around. The issue is actually in the db tasks in either the rake installation script or the badge migration scripts. The error happened because the db seemed to not pick up the proper table/field creations. It worked after I wiped my DB and recreated the tables/fields once again. Just FYI, hope that is helpful!

diego- commented 10 years ago

Also, was running the latest version 1.1.1.

joaomdmoura commented 10 years ago

Yeah it definitely is! I'll update the thread as soon as I discover what it is about.

joaomdmoura commented 10 years ago

@thelastinuit the problem is that I change the TYPE flag, I replaced it to KIND, I did this because of a Rails update that didn't let you use type as an attribute. @diego- I don't believe that this was your case, what is you database?

diego- commented 10 years ago

I am running sqlite and postgresql. However, I think there may have been two different versions of rails (3.2 in dev, 4.0 in prod) that may be responsible?

On Dec 6, 2013, at 3:43 PM, João Moura notifications@github.com wrote:

@thelastinuit the problem is that I change the TYPE flag, I replaced it to KIND, I did this because of a Rails update that didn't let you use type as an attribute. @diego- I don't believe that this was your case, what is you database?

— Reply to this email directly or view it on GitHub.

joaomdmoura commented 10 years ago

@diego- maybe, I'm trying to recreate the error, but the Rails version can be related.

joaomdmoura commented 10 years ago

@diego- I didn't find a way to replicate this, I hope that once I close the issue #56, refactoring part of the db tasks, it end up being fixed too. I'm closing it for now, but let me know if you find something new.