I have a model that I want to use for generating web pages. The pages will be what is rendered by a controller action. The generated pages will be FTP'ed to a hosting site where they will served up as static pages.
One approach is to do it like ActionController::TestCase:
class Page
belongs_to :book
def contents controller = BookController.new request = TestRequest.new response = TestResponse.new
request.path = "/books/#{book.id}" # show action controller.process(request, response) response.body end end
Then call page.contents will cause the BookController.show action to be called which renders a page. The rendered page then would be returned.
Is this the best way to do this?