5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/effective/classifieds_controller.rb', line 5
def show
@classified = resource_scope.find(params[:id])
if @classified.respond_to?(:roles_permit?)
raise Effective::AccessDenied.new('Access Denied', :show, @classified) unless @classified.roles_permit?(current_user)
end
EffectiveResources.authorize!(self, :show, @classified)
if EffectiveResources.authorized?(self, :admin, :effective_classifieds)
flash.now[:warning] = [
'Hi Admin!',
('You are viewing a hidden classified.' unless @classified.published?),
'Click here to',
("<a href='#{effective_classifieds.edit_admin_classified_path(@classified)}' class='alert-link'>edit classified settings</a>.")
].compact.join(' ')
end
@page_title ||= @classified.to_s
end
|