Rendering text with textilize

I’m building a site where the pages pull from a database so I can
build a simple content management system for the client. The client
will get a giant textarea to edit which then gets textilized on
output.

So I tried this for the homepage, but textilize didn’t work (undefined
method error). Is there a better way to accomplish what I want? I’d
like to avoid using individual rhtml files for the pages since each
page is simply database content.

def index
render(:text=> textilize(ContentAreas.find_by_name(“overview”).content),
:layout=>“content”)
end

Thanks!

Brian

On 3-dec-2005, at 0:04, Brian Morykon wrote:

def index
render(:text=> textilize(ContentAreas.find_by_name
(“overview”).content),
:layout=>“content”)
end

I don’t think textilize() is available as a method inside the
controller context. You will need to hook it into
your controller or directly call RedCloth (that would be the best in
your case)

def index
render :text=>RedCloth.new(ContentAreas.find_by_name
(‘overview’).content).to_html, :layout=>‘content’
end


Julian ‘Julik’ Tarkhanov
me at julik.nl

def index
render :text=>RedCloth.new(ContentAreas.find_by_name
(‘overview’).content).to_html, :layout=>‘content’
end

def index
@content = ContentAreas.find_by_name(‘overview’).content
render :inline => “<%= textilize @content %>”, :layout => ‘content’
end


rick
http://techno-weenie.net

Julik and Rick,

I ended up going with Rick’s inline approach (although the other is
good to know!). I had tried render :inline before but had the database
call in the render line instead of broken out in a variable. Works
perfect now.

Thank you both!