Closed h0tl33t closed 10 years ago
There's an undocumented sprig_file
feature in Sprig, that lets you store files within a files
directory and upload them to records just like they were uploaded from a browser. For example, if you had a cat picture at db/seeds/development/files/cat.png
, you could attach it to a record with <%= sprig_file('cat.png') %>
.
You might consider handling files differently than other attributes, by first adding them to the files
dir, then including a sprig_file
reference in the seed file.
(I shall work on documenting this feature in Sprig.)
:+1: to these updates
looks good other than that filename uniqueness stuff :+1:
Thanks guys!
This PR covers the following:
Sprig::Reap::Association
by using some of the built-in methods onActiveRecord::Reflection::AssociationReflection
belongs_to
associations that can benil
(would previously throw an error)read_attribute
instead ofsend
(should fix #5)