fardin
fardin

Reputation: 1477

Rails meta tags gem title

Using Meta-Tags gem, in my blog post show page this piece of code prints the code itself instead of showing its value, which is the blog post title!

<% title '#{@blog_post.title}' %>

What's wrong with it? Seems like such easy problem but haven't come up with a solution yet!

Upvotes: 0

Views: 210

Answers (2)

Dharam Gollapudi
Dharam Gollapudi

Reputation: 6438

If you need to have ruby interpolation, then you need to use double quotes, not single quotes.

Try changing this:

<% title '#{@blog_post.title}' %>

to this:

<% title "#{@blog_post.title}" %>

Then it should work.

Upvotes: 1

Pitabas Prathal
Pitabas Prathal

Reputation: 1012

Try this:

 <% title "#{@blog_post.title}" %>

Upvotes: 1

Related Questions