Fix bug preventing Platinum users from commenting.
Bug:
Platinum users get this error when commenting:
No route matches {:action=>"show", :controller=>"posts", :id=>nil}
missing required keys: [:id]
Fix:
The issue was that `CurrentUser.role` was nil for Platinum users, which
caused `Comment.create(create_params, :as => CurrentUser.role)` to
silently ignore the create_params because the nil role wasn't in the
attr_accessible whitelist.
Despite this, things worked accidentally for other models because they
had `attr_accessible ..., :as => [:default]` in their whitelists where
the comment model didn't.
This commit is contained in:
@@ -369,6 +369,9 @@ class User < ActiveRecord::Base
|
||||
when Levels::GOLD
|
||||
:gold
|
||||
|
||||
when Levels::PLATINUM
|
||||
:platinum
|
||||
|
||||
when Levels::BUILDER
|
||||
:builder
|
||||
|
||||
|
||||
Reference in New Issue
Block a user