module Neo4jrb::Paperclip::ClassMethods
Public Instance Methods
after_commit(*args, &block)
click to toggle source
Adds after_commit
# File lib/neo4jrb_paperclip.rb, line 59 def after_commit(*args, &block) options = args.pop if args.last.is_a? Hash if options case options[:on] when :create after_create(*args, &block) when :update after_update(*args, &block) when :destroy after_destroy(*args, &block) else after_save(*args, &block) end else after_save(*args, &block) end end
has_attached_file(field, options = {})
click to toggle source
This method is deprecated
# File lib/neo4jrb_paperclip.rb, line 104 def has_attached_file(field, options = {}) raise "Neo4jrb::Paperclip#has_attached_file is deprecated, " + "Use 'has_neo4jrb_attached_file' instead" end
has_neo4jrb_attached_file(field, options = {})
click to toggle source
Adds Neo4jrb::Paperclip's “#has_neo4jrb_attached_file” class method to the model which includes Paperclip
and Paperclip::Glue in to the model. Additionally it'll also add the required fields for Paperclip
since MongoDB is schemaless and doesn't have migrations.
# File lib/neo4jrb_paperclip.rb, line 82 def has_neo4jrb_attached_file(field, options = {}) ## # Include Paperclip and Paperclip::Glue for compatibility include ::Paperclip include ::Paperclip::Glue ## # Invoke Paperclip's #has_attached_file method and passes in the # arguments specified by the user that invoked Neo4jrb::Paperclip#has_neo4jrb_attached_file has_attached_file(field, options) ## # Define the necessary collection fields in Neo4jrb for Paperclip property :"#{field}_file_name", type: String property :"#{field}_content_type", type: String property :"#{field}_file_size", type: Integer property :"#{field}_updated_at", type: DateTime end