No commit activity in last 3 years
No release in over 3 years
Neo4jrb::Paperclip enables you to use Paperclip with Neo4j.rb
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

> 3.0.0.alpha.8
>= 4.0
 Project Readme

Neo4jrb::Paperclip - Making Paperclip play nice with Neo4j.rb 3.0

This gem is based on mongoid-paperclip 0.0.4. It is a fork of Leo Lou's original gem, updated for Neo4j.rb 3.0. It is platform-independent and compatible with Paperclip 4.2.0.

As the title suggests: Neo4jrb::Paperclip makes it easy to hook up Paperclip with Neo4j.rb.

This is actually easier and faster to set up than when using Paperclip and the ActiveRecord ORM. This example assumes you are using Ruby on Rails 4 and Bundler.

Setting it up

Simply define the neo4jrb-paperclip gem inside your Gemfile, pulling from subvertallchris/neo4jrb-paperclip. Additionally, you can define the aws-sdk gem if you want to upload your files to Amazon S3. You do not need to explicitly define the paperclip gem itself, since this is handled by neo4jrb-paperclip.

Rails.root/Gemfile - Just define the following:

gem "neo4jrb-paperclip", github: 'subvertallchris/neo4jrb-paperclip', require: "neo4jrb_paperclip"
gem "aws-s3"

Next let's assume we have a User model and we want to allow our users to upload an avatar.

Rails.root/app/models/user.rb - include the Neo4jrb::Paperclip module and invoke the provided class method

class User
  include Neo4j::ActiveNode
  include Neo4jrb::Paperclip

  has_neo4jrb_attached_file :avatar
  validates_attachment_content_type :avatar, content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"]
end

That's it

More or less. See Paperclip's documentation for additional instructions. Invoking the has_neo4jrb_attached_file method will automatically define the necessary :avatar fields for you in the background.

Known issues

File size returns 0 - paperclip issue

Related Links