user2184718
user2184718

Reputation: 715

Opening .html.erb files in browser

Is there a way to open .html.erb files by themselves in the browser. The Rails app I am trying to have a look at is in rails 2.3 and will not run locally on the rails server nor will it run when I give the command script/server.

I would just like to open the individual views in the browser by themselves...is this possible?

Upvotes: 0

Views: 8299

Answers (2)

TsaiKoga
TsaiKoga

Reputation: 13404

In rails4 you can do it like this:

erb a.html.erb > a.html

Maybe it doesn't work in rails 2.3. If you want to render that view, maybe you can use an action just like users#index and change the code to render it:

render "devise/mailer/a.html.erb", :layout => false

Upvotes: 1

mkis
mkis

Reputation: 441

You can open them in the browser, but the <% %> and <%= %> tags will get shown as-is instead of executing the Ruby code. These are template files that need to get processed by Rails to fill in data at runtime. Your best bet is TsaiKoga's answer, making a controller action render the template in question.

Upvotes: 1

Related Questions