patshaughnessy / paperclip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from thoughtbot/paperclip
Forked to store files in a database table
Home Page: http://patshaughnessy.net/paperclip-database-storage
License: Other
This project forked from thoughtbot/paperclip
Forked to store files in a database table
Home Page: http://patshaughnessy.net/paperclip-database-storage
License: Other
It seems that rails 3.2.8 removed a deprecated method, upon which this fork of paperclip relies.
More info:
http://stackoverflow.com/questions/12258735/read-inheritable-attribute-undefined-in-rails-3-2-8
Here's a copy of the output when I run 'rake test':
https://gist.github.com/anonymous/5255123
If you're not able to trouble-shoot, I completely understand. Hope to hear back from you,
Karrick
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.
It's been about a year... Time to sync up with the parent project again?
Thanks for your work on this helpful project.
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!
hi..
i use paperclip for storage database..
but when i use this, i got this message
Photo Paperclip::CommandNotFoundError
what i've done ?
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!
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)
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.