lib/app/models/layout.rb in slightcms-0.0.9 vs lib/app/models/layout.rb in slightcms-0.0.11

- old
+ new

@@ -12,9 +12,19 @@ # Validations validates_presence_of :name validates_uniqueness_of :name validates_presence_of :content + + # Create a file accessor + attr_accessor :file + + # Write file to content if file is uploaded + def file=(uploaded_file) + unless uploaded_file.nil? + write_attribute(:content, uploaded_file.read) + end + end end end \ No newline at end of file