f9b309d342
A story downvote is considered a flag, just meaning the story has problems and not necessarily that the user wants to ignore it. By moving hiding out of Vote and into a new HiddenStory model, a user can now both downvote/flag and hide separately, or just one or the other.
12 lines
282 B
Ruby
12 lines
282 B
Ruby
class HiddenStory < ActiveRecord::Base
|
|
belongs_to :user
|
|
belongs_to :story
|
|
|
|
validates_presence_of :user_id, :story_id
|
|
|
|
def self.hide_story_for_user(story_id, user_id)
|
|
HiddenStory.where(:user_id => user_id, :story_id =>
|
|
story_id).first_or_initialize.save!
|
|
end
|
|
end
|