jeudi 3 septembre 2015

Rails keeping a file in database

I have User and Attachment model

attachment model

create_table :attachments do |t|
  t.attachment :file
  t.belongs_to :user
  t.timestamps null: false
end

I want to write some data line by line, for example user.name and user.surname, in attachments file and keep it in database. How can I create the file?

Aucun commentaire:

Enregistrer un commentaire