3

Afternoon All,

I have just loaded merit gem, I've set up all my badges but on the action I see the following:

WARNING: Can't mass-assign protected attributes for Merit::Action:
user_id, action_method, action_value, had_errors, target_model,
target_id

I've tried putting the it in user attr_accessible but don't really want to give away the user_id like that.

Here is the point system:

score 10, :to => :user, on: 'snippets#create' do |comment|
   comment.content.present?
end

Has anyone come across this issue.

I read the issues on github and has_merit in the model shouldn't cause this issue.

Here is the full log, if I'm readying this right it warns me and continues the insert anyway but my user has no points or badges.

   (2.5ms)  COMMIT
   (0.1ms)  BEGIN
  SQL (3.3ms)  UPDATE "snippets" SET "user_id" = $1, "updated_at" = $2 WHERE "snippets"."id" = 11  [["user_id", 1], ["updated_at", Fri, 22 Nov 2013 16:55:02 UTC +00:00]]
  Merit::Sash Load (0.3ms)  SELECT "sashes".* FROM "sashes" WHERE "sashes"."id" = $1 ORDER BY "sashes"."id" ASC LIMIT 1  [["id", 3]]
  Merit::Score Load (1.5ms)  SELECT "merit_scores".* FROM "merit_scores" WHERE "merit_scores"."sash_id" = $1 AND "merit_scores"."category" = 'default' ORDER BY "merit_scores"."id" ASC LIMIT 1  [["sash_id", 3]]
   (1.7ms)  SELECT SUM("merit_score_points"."num_points") AS sum_num_points, score_id AS score_id FROM "merit_score_points" WHERE "merit_score_points"."score_id" = $1 GROUP BY score_id  [["score_id", 3]]
   (3.5ms)  COMMIT
Redirected to http://0.0.0.0:3000/books/1
WARNING: Can't mass-assign protected attributes for Merit::Action: user_id, action_method, action_value, had_errors, target_model, target_id

   (0.4ms)  BEGIN
  SQL (0.5ms)  INSERT INTO "merit_actions" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"  [["created_at", Fri, 22 Nov 2013 16:55:02 UTC +00:00], ["updated_at", Fri, 22 Nov 2013 16:55:02 UTC +00:00]]
   (1.4ms)  COMMIT
  Merit::Action Load (0.5ms)  SELECT "merit_actions".* FROM "merit_actions" WHERE "merit_actions"."processed" = 'f'
   (0.2ms)  BEGIN
  SQL (4.6ms)  UPDATE "merit_actions" SET "processed" = $1, "updated_at" = $2 WHERE "merit_actions"."id" = 13  [["processed", true], ["updated_at", Fri, 22 Nov 2013 16:55:02 UTC +00:00]]
   (1.4ms)  COMMIT
Completed 302 Found in 226ms (ActiveRecord: 43.0ms)

Little bit lost.

Shaun Frost Duke Jackson
  • 1,256
  • 1
  • 10
  • 22

1 Answers1

0

Problem was that merit wasn't yet prepared for the combination of Rails 4 and protected_attributes gem. Fixed since today in master.

TuteC
  • 4,342
  • 30
  • 40