Files
grecia/app/models/follow.rb
Javi Martín 8a47fe3505 Avoid a brakeman security warning
Although it wasn't a real security concern because we were only calling
a `find` method based on the user input, it's a good practice to avoid
using constants based on user parameters.

Since we don't use the `find` method anymore but we still need to check
the associated record exists, we're changing the `followable` validation
in the `Follow` model to do exactly that.
2021-04-13 13:52:18 +02:00

8 lines
178 B
Ruby

class Follow < ApplicationRecord
belongs_to :user
belongs_to :followable, polymorphic: true
validates :user_id, presence: true
validates :followable, presence: true
end