Sha256: be53767f30db1a7b30bf110ad7b61bf1f8b6fb4f546c50d188c3621c5e13c2fb
Contents?: true
Size: 672 Bytes
Versions: 5
Compression:
Stored size: 672 Bytes
Contents
class SimpleDiscussion::ApplicationController < ::ApplicationController layout "simple_discussion" def page_number page = params.fetch(:page, '').gsub(/[^0-9]/, '').to_i page = "1" if page.zero? page end def is_moderator_or_owner?(object) is_moderator? || object.user == current_user end helper_method :is_moderator_or_owner? def is_moderator? current_user.respond_to?(:moderator) && current_user.moderator? end helper_method :is_moderator? def require_moderator_or_author! unless is_moderator_or_owner?(@forum_thread) redirect_to simple_discussion.root_path, alert: "You aren't allowed to do that." end end end
Version data entries
5 entries across 5 versions & 1 rubygems