Giter Site home page Giter Site logo

patshaughnessy / paperclip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thoughtbot/paperclip

53.0 53.0 25.0 1.93 MB

Forked to store files in a database table

Home Page: http://patshaughnessy.net/paperclip-database-storage

License: Other

Ruby 100.00%

paperclip's People

Contributors

abelmartin avatar alexgodin avatar andrewtimberlake avatar bjhess avatar cainlevy avatar danielevans avatar dasch avatar djanowski avatar francocatena avatar fxposter avatar henrik avatar ihid avatar jferris avatar jhawthorn avatar joshuaclayton avatar lardawge avatar mike-burns avatar momolog avatar monde avatar murbanski avatar mvanholstyn avatar nickrivadeneira avatar nono avatar overbryd avatar patshaughnessy avatar qrush avatar sikachu avatar szajbus avatar takuyan avatar tilsammans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

paperclip's Issues

DFS

Is possible to storing files similar DFS? for example webresource, encrypt files in different locations, steganography etc.?

For example I can use my files from everywhere but using free services and web pages t o storing my data
Some of resources are encrypted and only I can use it.

PaperClip File Upload to Database.

Hi all,

I'm need to store the uploaded file into mysql database using Paperclip. In Model, I mentioned as "has_attached_file :attach, :storage => :database". I'm getting the error as "Paperclip::Errors::StorageMethodNotFound (Cannot load storage module 'Database')" while uploading the file . Can anyone help me out ?

Thank You.

duplicate dependency on cocaine

The gemspec at /home/anthony/thumbnail-endpoint/shared/bundle/ruby/1.9.1/bundler/gems/paperclip-729848221b19/paperclip.gemspec is not valid. The validation error was 'duplicate dependency on cocaine (> 0.2, development), (>= 0.0.2) use: add_runtime_dependency 'cocaine', '> 0.2', '>= 0.0.2' ' (Bundler::InvalidOption)

Deprication warning

I got the following deprication warning when starting up my rails server:

DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated: C:/myapp/vendor/plugins/paperclip_blob/rails/init.rb. (called from C:/myapp/config/environment.rb:5)

Great plugin. Thanks!

Namespaced Controllers

I'm having a lot of trouble getting the "downloads_files_for" to work with a namespaced controller, for example, in my clients controller:

class Admin::ClientsController < ApplicationController
  before_filter :authenticate_user!
  load_and_authorize_resource :class => "Admin::Client", :message => "Not authorized"
  downloads_files_for :admin_client, :logo_small
...

In database.rb, I tried adding this into downloads_files_for:

model_record = model.split('::').reduce(Object){|cls, c| cls.const_get(c)}.find(user_id)

and calling it with:

downloads_files_for "Admin::Client", :logo_small

But it didn't work, even though that way of making a variable class name works in the controller (so i know that method does work somewhere!).

I also know that the image is in the database. As a temporary fix, I made an additional action:
def client_logo
@image = Admin::Client.find(current_user.client_id)
send_data @image.logo_small_file, :type => 'image/png', :disposition => 'inline'
end

...and THAT works... but it's not Paperclip. Any ideas?

Any help would be greatly appreciated. Thanks!

Time for another rebase?

It's been about a year... Time to sync up with the parent project again?

Thanks for your work on this helpful project.

"missing attribute" error occurs when the attribute is accessed in after_initialize

My model 'collector' has 'param1' column and I defined paperclip as follows.

has_attached_file :attachment, :storage => :database
default_scope select_without_file_columns_for(:attachment)

I also put the following line into the controller class.

downloads_files_for :collector, :attachment

When I try to download the attachment via the controller, I met the following error.

missing attribute: param1

C:/Documents and Settings/yebihara/My Documents/NetBeansProjects/rails/test/app/models/collector.rb:223:in `after_initialize'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:347:in `send'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:347:in `callback'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1687:in `send'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1687:in `instantiate'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:664:in `find_by_sql'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:664:in `collect!'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:664:in `find_by_sql'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1578:in `find_every'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1613:in `find_one'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1599:in `find_from_ids'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:619:in `find'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2731:in `reload_without_dirty'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2178:in `with_scope'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2186:in `with_exclusive_scope'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2731:in `send'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2731:in `reload_without_dirty'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/dirty.rb:94:in `reload_without_autosave_associations'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/autosave_association.rb:202:in `reload'
C:/Documents and Settings/yebihara/My Documents/NetBeansProjects/rails/test/vendor/plugins/paperclip/lib/paperclip/storage/database.rb:108:in `instance_read_file'
C:/Documents and Settings/yebihara/My Documents/NetBeansProjects/rails/test/vendor/plugins/paperclip/lib/paperclip/storage/database.rb:120:in `file_contents'
C:/Documents and Settings/yebihara/My Documents/NetBeansProjects/rails/test/vendor/plugins/paperclip/lib/paperclip/storage/database.rb:195:in `attachments'
C:/Program Files/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in `send'
...

My model accesses the 'param1' attribute in after_initialize method.
I found the following line of instance_read_file method in database.rb causes this error.

    instance.reload :select => column if !instance.attribute_present?(column) && !instance.new_record?

Since my 'param1' is not included in the :select list, it's not visible in after_initialize method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.