paperclip | Easy file attachment management for ActiveRecord | Application Framework library

 by   thoughtbot Ruby Version: v6.1.0 License: Non-SPDX

kandi X-RAY | paperclip Summary

kandi X-RAY | paperclip Summary

paperclip is a Ruby library typically used in Server, Application Framework, Ruby On Rails applications. paperclip has no bugs, it has no vulnerabilities and it has medium support. However paperclip has a Non-SPDX License. You can download it from GitHub.

For new projects, we recommend Rails' own [ActiveStorage]. For existing projects, please consult and contribute to the migration guide, available [in English], [en español], and as [a video] recorded at RailsConf 2019. Alternatively, for existing projects, [Kreeti] is maintaining [kt-paperclip], an ongoing [fork of Paperclip]. We will leave the Issues open as a discussion forum only. We do not guarantee a response from us in the Issues. All bug reports should go to kt-paperclip. We are no longer accepting pull requests except pull requests against the migration guide. All other pull requests will be closed without merging. [Paperclip is deprecated]: [ActiveStorage]: [in English]: [en español]: [a video]: [Kreeti]: [kt-paperclip]: [fork of Paperclip]:
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              paperclip has a medium active ecosystem.
              It has 9059 star(s) with 2446 fork(s). There are 181 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 39 open issues and 1808 have been closed. On average issues are closed in 349 days. There are 17 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of paperclip is v6.1.0

            kandi-Quality Quality

              paperclip has 0 bugs and 0 code smells.

            kandi-Security Security

              paperclip has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              paperclip code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              paperclip has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              paperclip releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              paperclip saves you 6163 person hours of effort in developing the same functionality from scratch.
              It has 12844 lines of code, 595 functions and 142 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed paperclip and discovered the below as its top functions. This is intended to give you an instant insight into paperclip implemented functionality, and help decide if they suit your requirements.
            • Create a new image
            • Post style .
            • Repropped options .
            • Resize a geometry .
            • Define an attachment
            • Set the value from the server
            • Set whether the timeout occurs
            Get all kandi verified functions for this library.

            paperclip Key Features

            No Key Features are available at this moment for paperclip.

            paperclip Examples and Code Snippets

            No Code Snippets are available at this moment for paperclip.

            Community Discussions

            QUESTION

            How can I apply a Font Awesome icon to a custom file input?
            Asked 2022-Feb-01 at 20:25

            I want to make a file input with HTML and CSS; I use the class of custom-file-input as shown in the picture, but instead of "browse" I want to add an icon which is fas fa-paperclip and add the label file before the input

            ...

            ANSWER

            Answered 2022-Feb-01 at 20:25

            You can't dump classes in as content and expect that to work. You also can't apply classes to pseudo-elements in general.

            Instead, you can add the Font Awesome 5 icon as an absolutely-positioned element.

            Source https://stackoverflow.com/questions/70946648

            QUESTION

            Nuxtjs/Toast and custom icons
            Asked 2022-Jan-06 at 15:16

            Is it possible to add an icon into the message of a toast error or do I need to install a different/another module? I'm using vue and trying to add a component as an icon at the moment but not having any luck.

            ...

            ANSWER

            Answered 2021-Nov-16 at 14:42

            Here it's written that you can pass either String or HTML.

            Since a Vue component is a bit more than that, you will probably not be able to pass it directly.

            Meanwhile, you could probably look for some HTML icon and inline it here.

            Source https://stackoverflow.com/questions/69989858

            QUESTION

            Unable to build and deploy Rails 6.0.4.1 app on heroku - Throws gyp verb cli error
            Asked 2022-Jan-02 at 10:07

            Hi i was deploying a branch on heroku and threw up this error. I also tried deploying a branch which worked perfectly, but that is also showing the same error.

            local yarn verion : 1.22.17 local node version : v12.22.7 Please help !!!

            Tried building without yarn.lock and package-lock same thing.

            This is how it starts Heroku deployment build log through CLI

            ...

            ANSWER

            Answered 2021-Dec-18 at 14:32

            I had a similar problem but resolved by following steps.

            1. Run the following command. heroku buildpacks:add heroku/nodejs --index 1
            2. Update node version from 16.x to 12.16.2 in package.json.

            Source https://stackoverflow.com/questions/70401055

            QUESTION

            Rails 6, Paperclip, S3, s3_direct_upload @attachment.save not saving after the s3_direct_upload completes
            Asked 2021-Nov-13 at 19:01

            I have re-written an application called FilterTrak from an older version of Rails v4.2 to Rails v6 and I have everything working now except one part of the picture upload.

            The app uses Paperclip, aws-sdk-v1, and s3_direct_upload. I previously had an issue with s3_direct_upload which I got working. The issue I am having now is after it uploads the file to s3 it is supposed to save the attachment which will give me an ID from the database which then calls a secondary process that is supposed to start.

            For reasons unknown the @attachment.save is not saving and because it is not saving it is not making a callback to the second process that is supposed to move the file into its perm location on S3 and then save that information into the DB. I have tried to manually call the second process but because the attachment isn't saving an ID isn't generated. Since I have no ID to work with I can't manually or otherwise call the second process. I believe I have troubleshot the issue to the controller and the @attachment.save line. If I inspect the @attachment.save right after that I get @attachment.save FALSE. This code is currently working as is on an older version of Rails right now. So I assume this part is not working due to some change in the newer version of Rails. I have spent over 2 solid weeks trying to figure this out and I haven't been able to make any progress. I was considering changing the app to use active storage but since the @attachment.save is the part I believe that isn't working I don't know if that would really do any good as the file upload doesn't seem to be where the problem is as far as I can tell. Since it DOES in fact upload to my S3 bucket into the /uploads folder successfully.

            Here is the attachments_controller.rb file.

            ...

            ANSWER

            Answered 2021-Nov-13 at 19:01

            On @attachment.save try @attachment.valid? to check if object is valid or not If the object is invalid then check the error messages by @attachment.errors.full_messages You can clearly see the missing and invalid attributes

            Here " @attachment: #" You can see the user_id is missing set user id then try again i hope after this your problem get resolve

            Source https://stackoverflow.com/questions/69917690

            QUESTION

            Rails 6, can not get s3_direct_upload gem to UPLOAD, view works fine
            Asked 2021-Nov-10 at 20:15

            I have 2 apps I have re-written from older versions of Rails (3.2 and 4.2.1) to Rails v6.1.4.1 and they both use the s3_direct_upload gem.

            On Both apps I do not get any errors in the Webdev console or in the Rails console or in the log or ANYPLACE I can find. The buckets are displaying just fine in the case of Both Apps.
            I checked the CORS Setup and it is fine. Both of these apps are currently running on Heroku with the code the same way it is now but are working.

            Does anyone know if the s3_direct_upload gem actually works with Rails 6?

            I get the file select window, I choose the filename, it shows the filename but instead of it starting the upload and showing the progress bar it just acts as if I did nothing at that point. No errors no nothing anyplace I can find. When I have the original app side by side at that point I should see a quick progress bar come up and then go away, the page refreshes and shows the new file. IN the 2 Apps I have re-written, it never gets past the file select and showing the file name of what I have selected. I will show the general files so at least that can be seen:

            So that is question 1, does the s3_direct_upload gem work in Rails 6?

            Here are the basic files that are required:

            s3_direct_upload.rb

            ...

            ANSWER

            Answered 2021-Nov-10 at 20:15

            I can confirm if you pull the latest version of the s3_direct_upload gem it does in fact properly upload to Amazon S3 using Rails 6, aws-sdk-v1 and Paperclip.

            To do this you have to pull the s3_direct_upload as a plugin instead of a GEM and you can do this by putting this in your gemfile:

            Source https://stackoverflow.com/questions/69501504

            QUESTION

            Rails 6 Amazon S3 Error POST 403 (Forbidden) using s3_direct_upload gem
            Asked 2021-Nov-10 at 17:46

            I have re-written 2 applications that uses older versions of Rails v3.2 and 4.2 to current Rails 6.1.4.1 In both applications cases I have everything working properly EXCEPT for the picture upload. At first I couldn't get the s3_direct_upload to work properly. Now it appears to be working, I get the progress bars starting but I get this darn POST 403 (Forbidden) error (it has the URL in the middle of the error). The s3_direct_upload gem basically just packages up the jQuery-file-upload gem to make it easier to implement after looking at its source code.

            https://github.com/waynehoover/s3_direct_upload

            What is strange in my case is I know it isn't a CORS issues because I am using the very same buckets, keys and everything that are CURRENTLY STILL WORKING in the original versions of these applications that still work on Heroku. Code is virtually the same the only change is the new version of Rails. BOTH give me the exact same error. IN both apps I can view pictures just fine. IT can access the buckets with the same keys ID and everything else.

            I then tried and made a sample app that uses the jQuery-file-upload gem (separate from the s3_direct_upload gem) as I wanted to verify if it was the s3_direct_upload gem causing the issue OR if it is the jQuery-file-upload gem that is causing the issues.

            https://github.com/railscasts/383-uploading-to-amazon-s3/tree/master/gallery-jquery-fileupload

            I made a Rails 6 version of this app and got it all working and to my horror, it is giving me the EXACT SAME ISSUE, POST 403 (Forbidden) error.
            I figured out how to enable the colsole.log in the JavaScript portion of the app and got it dump the error.

            Here is the full error from the console. (I put MYBUCKET in caps where my bucket name would be)

            ...

            ANSWER

            Answered 2021-Nov-10 at 17:46

            The problem on this turned out to be in the way s3_direct_upload was creating the upload FORM. It was adding a part to the form with $utf8 which apparently at some point was no longer allowed. IN the s3_direct_upload gem v0.1.7 in the /app/lib/form_helper.rb in the method def policy_data method this line had to be removed from the method:

            Source https://stackoverflow.com/questions/69654306

            QUESTION

            Rails: Rendering video uploaded by paperclip
            Asked 2021-Nov-06 at 23:22

            I am using Rails 6.1 + Ruby 3 and trying to allow users to upload videos and then watch them in app.

            clip.rb

            ...

            ANSWER

            Answered 2021-Nov-06 at 23:22

            while I'm not 100% sure this is the problem, I believe the Paperclip library is deprecated and it does not work with ruby 3. If you use the latest ruby 2 version is should work for you. However, I would recommend not depending on paperclip for new projects.

            Source https://stackoverflow.com/questions/68974262

            QUESTION

            S3 save old url, change paperclip config, set new url as old
            Asked 2021-Sep-20 at 08:57

            So here is the thing: currently our files, when user downloads them, have names like 897123uiojdkashdu182uiej.pdf. I need to change that to file-name.pdf. And logically I go and change paperclip.rb config from this:

            ...

            ANSWER

            Answered 2021-Sep-20 at 08:57

            With S3, you can set the "filename upon saving" as a header. Specifically, the user will get to an url https://foo.bar.com/mangled/path/some/weird/hash/whatever?options and when the browser will offer to save, you can control the filename (not the url).

            The trick to that relies on the browser reading the Content-Disposition header from the response, if it reads Content-Disposition: attachment; filename="filename.jpg" it will save (or ask the user to save as) filename.jpg, independently on the original URL.

            You can force S3 to add this header by adding one more parameter to the URL or by setting a metadata on the file.

            The former can be done by passing it to the url method:

            Source https://stackoverflow.com/questions/69251014

            QUESTION

            How can I extract a part of function in Rust when the return type of the extracted function is defined in terms of a trait?
            Asked 2021-Sep-20 at 02:11
            The Problem

            I am using Rust with vscode and the plugins brought in by "Rust and Friends v1.0.0".

            I would like to refactor a long function using the Extract Function technique but in some cases the IDE is not able to figure out the return type of the extracted function.

            I think the reason is that the type is described in terms of a trait and it is not possible to define that type as a return type.

            As I am new to Rust and I expect that my assessment is not accurate I will provide an example.

            Example

            I am using the paperclip crate to set up a REST server. The part that configures the server looks like this:

            ...

            ANSWER

            Answered 2021-Sep-20 at 02:11

            I'll assume you wanted the refactoring to change this:

            Source https://stackoverflow.com/questions/69247159

            QUESTION

            Can an office-addins add a column or icon into the message-list of folder (e.g. inbox)?
            Asked 2021-Jul-15 at 19:05

            My Outlook email message-list currently shows a user icon, the subject, sender-name, date, message preview, list of attachments, and a paper-clip attachment icon.

            I want my Outlook add-in to add another icon into that list (e.g. something next to where the paperclip lives - but anywhere/anyhow is fine by me - one for every email in their folder).

            Is this possible? I've spent a few hours looking for how to do this, but no luck (trying to work out that something which isn't there does not exist, is always harder than finding stuff that exists!!)

            ...

            ANSWER

            Answered 2021-Jul-15 at 19:05

            No, there is no way to show an extra icon. You can of course show text data from a user property - and given that you can use any Unicode character, it can look like an icon. But it won't function as a button.

            Source https://stackoverflow.com/questions/68398500

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install paperclip

            Paperclip is distributed as a gem, which is how it should be used in your app.

            Support

            Please check the documentation for the paperclip version you are using: https://github.com/thoughtbot/paperclip/releases. [![Build Status](https://secure.travis-ci.org/thoughtbot/paperclip.svg?branch=master)](http://travis-ci.org/thoughtbot/paperclip) [![Dependency Status](https://gemnasium.com/thoughtbot/paperclip.svg?travis)](https://gemnasium.com/thoughtbot/paperclip) [![Code Climate](https://codeclimate.com/github/thoughtbot/paperclip.svg)](https://codeclimate.com/github/thoughtbot/paperclip) [![Inline docs](http://inch-ci.org/github/thoughtbot/paperclip.svg)](http://inch-ci.org/github/thoughtbot/paperclip) [![Security](https://hakiri.io/github/thoughtbot/paperclip/master.svg)](https://hakiri.io/github/thoughtbot/paperclip/master). <!-- START doctoc generated TOC please keep comment here to allow auto update -→ <!-- DON’T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -→. <!-- END doctoc generated TOC please keep comment here to allow auto update -→. Paperclip is intended as an easy file attachment library for ActiveRecord. The intent behind it was to keep setup as easy as possible and to treat files as much like other attributes as possible. This means they aren’t saved to their final locations on disk, nor are they deleted if set to nil, until ActiveRecord::Base#save is called. It manages validations based on size and presence, if required. It can transform its assigned image into thumbnails if needed, and the prerequisites are as simple as installing ImageMagick (which, for most modern Unix-based systems, is as easy as installing the right packages). Attached files are saved to the filesystem and referenced in the browser by an easily understandable specification, which has sensible and useful defaults. See the documentation for has_attached_file in [Paperclip::ClassMethods](http://www.rubydoc.info/gems/paperclip/Paperclip/ClassMethods) for more detailed options. The complete [RDoc](http://www.rubydoc.info/gems/paperclip) is online.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/thoughtbot/paperclip.git

          • CLI

            gh repo clone thoughtbot/paperclip

          • sshUrl

            git@github.com:thoughtbot/paperclip.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Application Framework Libraries

            Try Top Libraries by thoughtbot

            guides

            by thoughtbotRuby

            bourbon

            by thoughtbotRuby

            laptop

            by thoughtbotShell

            factory_bot

            by thoughtbotRuby

            dotfiles

            by thoughtbotShell