1

Using modified version of http://railscasts.com/episodes/30-pretty-page-title for easier page heading and title.

Every page gets a <% title "insert heading here" %>. Via a helper

def title(page_title)
  content_for(:title) { page_title }
end

I can use it for page title and the headings of the single pages.

Also want to modify the view of my devise setup, but got stuck at the user edit page. The standard heading is <h2>Edit <%= resource_name.to_s.humanize %> </h2>.

Tried the obvious

<% title "Edit <%= resource_name.to_s.humanize %>" %>

But this dont work.

Any idea or suggestions? thanks in advance dennym

2
  • 1
    How about <% title "Edit #{resource_name.to_s.humanize}" %>? when using double quotes you can parse ruby inside #{} within a string May 2, 2013 at 16:14
  • thank you, that works. Put it as answer so i can give you the rep. May 2, 2013 at 16:20

1 Answer 1

4

How about

<% title "Edit #{resource_name.to_s.humanize}" %>?

when using double quotes you can parse ruby inside #{} blocks inside of a string. This won't work when using a string with single quotes (') only double (").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.