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
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
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!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.