I am completely new to rails, and I have a very useful way of dealing
with database structures from my background in php. I don't want to
be one of those who brings bad habits into rails...so I am curious if
my practices below violate rails' best practices.
(SQL is below, but I try to explain here for clarity) For example,
let's say I want a user's table in the database. I will usually
create it with only necessary information. Name, username, password,
timestamps, etc. Then I set up a "users_profiles" table that is
essentially a table with only three columns (1. A reference to the
user_id, 2. A 'key' column (varchar), and 3. A 'value' column
(text).). The primary key is a combo of the referenced user_id and
the 'key' column. Within my "user" model, I would instantiate an new
"users_profile", by calling $this->profile = new Users_Profiles().
Then, if I want to set an email, all I have to do is call $this->user-
profile->email = "example email". Then $this->user->save();. This
technique, allowed for extreme flexibility. Note that any call just
to $this->user->name would have to match the database table column
name, but with the key/value setup in the "users_profiles" table
(using a few setters and getters) I am able to set the "key" to email
without any change to the database.
I appreciated this flexibility and decreased need to alter the
database. Since I see huge advantage in the "Rails
Way"...particularly in ActiveRecord, I would like to adhere to "best-
practices." Does anyone know if this would be considered a poor way
of managing data in the "rails way". It seems to me that it would
function similarly, in that it would save a lot of updates with the db-
Thank you in advance for your help!
Here are the actual SQL statements for a real site.