I'm trying to auto generate page headings by path and currently I have this in my application_helper. The method works but is there a simpler way to write this?
def page_headings
if current_page? about_path
"about"
elsif
current_page? members_path
"members"
elsif
current_page? sponsors_path
"sponsors"
elsif
current_page? events_path
"events"
elsif
current_page? membership_path
"join us"
elsif
current_page? womens_path
"women's page"
elsif
current_page? new_session_path
"log in"
elsif
current_page? new_user_path
"register"
end
end
Then, in my partial, I add this:
<%= page_headings.upcase %>