I posted on a question with erb in SQL entries because I’ve been
building a CMS for my own website. I’ve built them before, but in
ColdFusion, and I’m not sure how best to approach it in Rails.
Right now, I have a simple database schema:
create_table “comments”, :force => true do |t|
t.column “post_id”, :integer
t.column “created_at”, :datetime
t.column “comment”, :text
end
create_table “events”, :force => true do |t|
t.column “title”, :string
t.column “desc”, :text
end
create_table “pages”, :force => true do |t|
t.column “title”, :string
t.column “body”, :text
end
create_table “posts”, :force => true do |t|
t.column “title”, :string
t.column “created_at”, :datetime
t.column “body”, :text
end
create_table “users”, :force => true do |t|
t.column “name”, :string
t.column “hashed_password”, :string
t.column “salt”, :string
end
The trouble is with pages. Right now, I just have the page load its
title and its body, which contains HTML. My problem is I need to have
pages with different layouts–in particular layouts that use AJAX to
dynamically load content.
I’m starting to think that maybe I’m structuring this incorrectly.
I’m just not sure how else to approach structuring the content other
than SQL entries. Any suggestions as to how a) I can create different
layouts and b) get some layout functionality in my SQL entries?
For example, I’m looking into liquid. That looks promising. But its
starting to look unrealistic to load both the content and the layout
from a SQL entry.
Thoughts?
Ron