user9903
user9903

Reputation:

Raw output from controller action method

I want to output some text without using a template. Right now I have a controller action method that's altering the Content-Type of the response and I want to display the text directly, without creating a template file (a single-line template file is useless).

Upvotes: 2

Views: 2099

Answers (1)

mu is too short
mu is too short

Reputation: 434685

You can use render :text in Rails 2.3:

You can send plain text – with no markup at all – back to the browser by using the :text option to render [...]

So this:

render :text => 'whatever'

should do what you want.

The same thing works in Rails 3.

Upvotes: 2

Related Questions