Method: ActiveFiles::Record::ClassMethods#add_file_id_to_initialize
- Defined in:
- lib/active_files/record.rb
#add_file_id_to_initialize ⇒ Object
Adds a parameter to the beginning of initialize to accept a file_id. If you run this, you must run it after your own initialize (or not have an initialize at all.)
Feel free to take care of file_id yourself somehow.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_files/record.rb', line 17 def add_file_id_to_initialize self.module_eval do def initialize_with_file_id(file_id, *args) self.file_id = file_id initialize_without_file_id(*args) end alias :initialize_without_file_id :initialize alias :initialize :initialize_with_file_id end end |