rctneil
rctneil

Reputation: 7210

Rails app specific content

My rails app is just a personal site. On the site I have content for main pages (mostly text) but I also want to have some other bits of content just as my email address and some social media names and so on.

It feels wrong to store this type of data as text in my actual app. Surely it should be in the database or something.

Is there a way I can store it in a sort of personal_settings table. I just cant see how I would store all the data in one table.

Any ideas?

Upvotes: 0

Views: 41

Answers (2)

Chapley Watson
Chapley Watson

Reputation: 188

One Idea (if you really want to use a database) for simple social media settings (single user)

# 1 - Facebook - 'fb.png'
# 2 - Twitter  - 'tw.png'

create_table :social_media do |t|
  t.string :name
  t.string :ico_url
end

# 1 - 'Apikey' - 'key_data'
# 2 - 'User' - 'user'
create_table :social_media_fields do |t|
  t.integer :social_media_id
  t.string  :name
  t.string  :value
end

Upvotes: 0

MikeC
MikeC

Reputation: 480

If you're only storing data on one person - yourself - it seems like a waste to go through setting up a database, etc. Your database would only have one row! That's not really the point of a database-backed web site. You need a database when users are adding their own data and requesting specific sets of data. Or maybe I'm misunderstanding what you're trying to do?

Upvotes: 1

Related Questions