Rails: Static html content in database

svetylikss

New Member
in my Rails application, a user can refer to a "sample" list of policies and create their own policies based on these samples. I am currently storing the list of "sample" policies and their associated textual HTML descriptions in a SamplePolicy model with a column name Content. Users can read about these sample policies and then create their own versions which are in turn stored in another model called Policy which holds a one-to-many relation with SamplePolicy model. See database structure below:\[code\]SamplePolicy--------------------------------------------------------------| ID | Name | Content | --------------------------------------------------------------| 1 | Privacy | <html>Sample..</html>--------------------------------------------------------------| 2 | Copyright policy | <html> Sample....</html>--------------------------------------------------------------Policy---------------------------------------------------------------------------------------| ID | Name | Content | samplepolicy_id---------------------------------------------------------------------------------------| 1 | Custom Privacy | <html>My Sample..</html> | 1--------------------------------------------------------------------------------------| 2 | Custom Copyright policy | <html> My Sample....</html> | 2--------------------------------------------------------------------------------------\[/code\]Question is:Is this the best way to structure my models?Since the list of "Sample policies" does not change, I guess I can use "seeds.rb" to populate my application but then I will not be able to refer to these sample policies in my Policy model (See foreign key samplepolicy_id). But then again, I am not sure about storing HTML content in my database.
 
Back
Top