README.rdoc in mm-attach-it-0.2.1 vs README.rdoc in mm-attach-it-0.2.2
- old
+ new
@@ -69,18 +69,36 @@
has_attachment :photo, { :path => '/:rails_root/public/images/foos/:id/:style/:filename' }
end
OBS: The default directory is ’/:rails_root/public/system/:attachment/:id/:style/:filename’
+
+Also you can interpolate any method result of the model
+
+ class Foo
+ include MongoMapper::Document
+ plugin AttachIt
+ has_attachment :photo, { :url => '/:model.say_greet/users/:model.say_farewell/:id/:filename', :path => ':rails_root/public/:model.say_greet/:model.say_farewell/users/:id/:filename' }
+
+ def say_greet
+ 'hello'
+ end
+
+ def say_farewell
+ 'bye'
+ end
+ end
+
Where:
* :rails_root - is the root directory of your Rails application
* :environment - can be "production", "test" or "development"
* :class - the name of the class (in the example given above, ‘foo’)
* :attachment - is the name of the column’s collection (in the example given above, ‘photo’)
* :id - the "id" of the record on MongoDB
* :style - if you specified the styles
* :filename - the name of the file
* :extension - the extension of the file
+* :model.METHOD_NAME - where METHOD_NAME is any method of the model
=== View
Check the model below