Using erb inside erb at Ruby on Rails

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

Answers


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 (").


Need Your Help

Is it possible to disable CSS styling for a single node in JavaFX 8?

css performance javafx javafx-8

For performance reasons I would like to disable CSS styling for some of my nodes. I have several thousands of them and I would really like to simply fill them with a solid background color, so not ...

How to hide sensitive data from developers

php svn passwords

I'm wondering how we could hide sensitive data (databases passwords and other passwords) from some developers for our PHP projects. We are using Subversion for our projects. Is it enough to just di...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.