paperclip | Easy file attachment management for ActiveRecord | Application Framework library
kandi X-RAY | paperclip Summary
kandi X-RAY | paperclip Summary
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
Top functions reviewed by kandi - BETA
- 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
paperclip Key Features
paperclip Examples and Code Snippets
Community Discussions
Trending Discussions on paperclip
QUESTION
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:25You 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.
QUESTION
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:42Here 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.
QUESTION
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:32I had a similar problem but resolved by following steps.
- Run the following command.
heroku buildpacks:add heroku/nodejs --index 1
- Update node version from
16.x
to12.16.2
in package.json.
QUESTION
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:01On @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
QUESTION
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:15I 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:
QUESTION
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:46The 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:
QUESTION
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:22while 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.
QUESTION
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:57With 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:
QUESTION
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.
ExampleI 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:11I'll assume you wanted the refactoring to change this:
QUESTION
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:05No, 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.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install paperclip
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page