Guest User

Untitled

a guest
Jan 4th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.34 KB | None | 0 0
  1.     # Get the id of the current page
  2.     def current_page_id
  3.         url = request.fullpath
  4.         action = ActionController::Routing::Routes.recognize_path(url)
  5.         id = false
  6.         Page.all.each do |page|
  7.           if page.slug["name"] == action
  8.             id = page.id
  9.           end
  10.         end
  11.         return id
  12.     end
Add Comment
Please, Sign In to add comment