Class: BlabsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/blabs_controller.rb

Instance Method Summary collapse

Instance Method Details

#blabs_admin_requiredObject



9
10
11
# File 'app/controllers/blabs_controller.rb', line 9

def blabs_admin_required
  send(Blabs.admin_method)
end

#blabs_current_user_nameObject



3
4
5
6
7
# File 'app/controllers/blabs_controller.rb', line 3

def blabs_current_user_name
  if respond_to?(Blabs.current_user_method, true)
    send(Blabs.current_user_method).try(:name)
  end
end

#check_is_adminObject



14
15
16
17
18
19
# File 'app/controllers/blabs_controller.rb', line 14

def check_is_admin
  unless blabs_admin_required
    flash[:error] = "Don't have rights sorry"
    redirect_to "/"
  end
end

#pretty_blog_post_path(blog_post) ⇒ Object



21
22
23
# File 'app/controllers/blabs_controller.rb', line 21

def pretty_blog_post_path(blog_post)
  "/blog/#{blog_post.path}"
end

#pretty_blog_post_url(blog_post) ⇒ Object



26
27
28
# File 'app/controllers/blabs_controller.rb', line 26

def pretty_blog_post_url(blog_post)
  request.protocol + request.host_with_port + pretty_blog_post_path(blog_post)
end