Module: ActsAsMultipartForm::MultipartFormInModel::ClassMethods
- Defined in:
- lib/acts_as_multipart_form/multipart_form_in_model.rb
Instance Method Summary collapse
-
#multipart_formable(*args) ⇒ Object
Adds the information to the model needed to do conditional validations on the multipart forms Creates the multipart_forms field to store the list of forms the model has access to Creates the multipart_form_controller_action field to store the form the controller is currently on This is used for validations among other things.
Instance Method Details
#multipart_formable(*args) ⇒ Object
Adds the information to the model needed to do conditional validations on the multipart forms Creates the multipart_forms field to store the list of forms the model has access to Creates the multipart_form_controller_action field to store the form the controller is currently on This is used for validations among other things
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/acts_as_multipart_form/multipart_form_in_model.rb', line 21 def multipart_formable(*args) mattr_accessor :multipart_form_controller_action unless self.respond_to?(:multipart_form_controller_action) mattr_accessor :multipart_forms unless self.respond_to?(:multipart_forms) self.multipart_forms = [] unless self.multipart_forms.is_a?(Array) self.multipart_forms |= args[0][:forms] # after save, the current controller action should not be set after_save :reset_multipart_form_controller_action include ActsAsMultipartForm::MultipartFormInModel::InstanceMethods end |