0

I have the same problem, as in this question. Did anybody find any solutions for this?

So I can't do like this:

flash[:notice] = "Successfully created #{@template.link_to('product', @product)}.

or like this:

@template.title("Page title is here.")

It worked perfectly in Rails 2.3. The main idea is to find out, how to use helper methods directly from conrollers, not from views.

Thanks.

Community
  • 1
  • 1
Igor Alexandrov
  • 236
  • 1
  • 5

2 Answers2

0

You're doing it wrong.

First, you should setup the title of a page inside the view, not in your controller. You can simply place a call to the title helper within your view file.

About the link, flash shouldn't contain HTML. However, you can create the link manually.

flash[:notice] = %Q{Successfully created <a href="#{product_path(@product)}">product</a>.}
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
0

I ran into this same problem as well and found that you can use the view_context method.

API documentation here: http://api.rubyonrails.org/classes/AbstractController/Rendering.html#method-i-view_context

Chu Yeow
  • 977
  • 1
  • 9
  • 16