开发者

Export HTML files from a SQLite 3 database (Ruby on Rails app)

开发者 https://www.devze.com 2023-01-19 12:42 出处:网络
I\'m new to Ruby on Rails, looking at using it for an app that I need to create. The story is: I\'m using rails generate scaffold Page url:string parent:string content:text to create a Page scaffold.

I'm new to Ruby on Rails, looking at using it for an app that I need to create. The story is:

I'm using rails generate scaffold Page url:string parent:string content:text to create a Page scaffold. So we can then input a URL (hello-there.htm), a parent (my-folder) and lots of text, images, etc for the page into a web form, and have it stored.

Once this is all in the SQLite database, it needs to be exported to lots of HTML files. So, on disk somewhere, I need each parent folder to be created, filled with HTML files which themselves contain the content (plus a static header/footer):

other-folder/index.htm
other-folder/another-file.htm
my-folder/hello-there.htm

Sorry, I know this is a really vague, hand-wavy question. My gut says I could开发者_如何学C/should use an Export view/controller (localhost:3000/export) which has a big button on it? But if you have something, anything I could read, it would be appreciated. Modifying the view for each page (localhost:3000/pages/12) is easy, but what do I do when I need loads of actual .htm files?

I wish I could post some code, but obviously there isn't any yet :(

Cheers,

Alex


Maran links to Webby below, which looks perfect for my needs!


(Answering this myself, just so that it shows up as answered)

Maran linked to Webby, a static site generator, in the comments. This was actually what I was looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消