personal-book/app/helpers/admin/books_helper.rb

10 lines
292 B
Ruby

module Admin::BooksHelper
def page_for_book(book_object)
book_page = nil
page = Page.find_by(:module=>"book") rescue nil
book_page = page if book_page.nil?
request.protocol+(request.host_with_port+book_page.url+'/'+book_object.to_param).gsub('//','/') rescue "/"
end
end