paperclip

Using Paperclip with Padrino

此生再无相见时 提交于 2019-12-06 13:37:32
Background: I'm building a simple blog using Padrino, Ruby 1.9.2, HAML, and Heroku. I want the posts index to have a magazine-like look to it. For each post in the index, the user should see titles, content teasers, and images. My problem is with attaching the images. Problem: I've been trying to use the Paperclip gem to attach an image to each post. Heroku will fish the actual image from an Amazon S3 bin. So far, when I try to run a migration, I get the error: $ .../base.rb:1088:in `method_missing': undefined method `has_attached_file' for #<Class:0xa672140> (NoMethodError) It looks like

Paperclip::Errors::MissingRequiredValidatorError

时光总嘲笑我的痴心妄想 提交于 2019-12-06 12:22:10
Sorry, but i cant found solution for my situation I have next code: class Document < ActiveRecord::Base has_attached_file :item, content_type: { content_type: ["image/jpeg", "image/gif", "document/pdf"] } end gemfile: source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.1' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4

Upgrading 1.8.7 to 1.9.3, paperclip s3 upload not working

☆樱花仙子☆ 提交于 2019-12-06 12:21:40
While i am migrating from Ruby 1.8.7 to 1.9.3, facing one issue on Paperclip photo upload. We have Paperclip configured, with s3 as a store. It works fine when i run rails server using 1.8.7, but its not uploading the file (without any error) with 1.9.3. Please have a look at configuration and log. paperclip config: has_attached_file :pic, :styles => { :thumb => "100x100#", :one => "118x100#", :two => "222x149#", :three => "460x345#", :popup => "480x360#" }, :storage => :s3, :s3_credentials => Settings.amazon_s3.to_hash, :path => ":attachment/:id/:style/:filename", :bucket => Settings.amazon

Multiple Images for Multiple Models - Paperclip, Rails

…衆ロ難τιáo~ 提交于 2019-12-06 11:51:33
I have four models, let's call them Cars and Houses. Users can have multiple cars, and multiple houses. Cars and Houses belong to Users. I'd like users to be able to upload multiple photos of their cars, and multiple photos of their houses, and from what I've read this means creating a new model called 'Photos'. Is it possible for two different models to both have_many Photos, and for Photos to belong_to more than one model? I'm using Ruby 2.0.0 and Rails 4. Sketch / PseudoRuby User has_many :cars has_many :houses Car belongs_to :user has_many :photos House belongs_to :user has_many :photos

Can not run 'rake paperclip:refresh:thumbnails CLASS=Spree::Image' in rails spree app console getting No Such Key

流过昼夜 提交于 2019-12-06 10:02:59
问题 I am trying to RAILS_ENV=production run rake paperclip:refresh:thumbnails CLASS=Spree::Image on my remote server in my current rails app directory, so I can refresh the spree images that I have uploaded in the past. I am using S3, my bucket is setup correctly as I can see each of my product's images in individual ID folders in my AWS S3 bucket. But each time I run the above command I get a 'No Such Key' Error when the rake is aborted. This command runs locally and works fine. (obviously

Paperclip: Multiple “has_attached_file” in one Model

老子叫甜甜 提交于 2019-12-06 07:28:04
问题 snippet from my model: attr_accessible :package1_file_name, :package2_file_name has_attached_file :package1 has_attached_file :package2 from my _form (simplified version): <%= form_for(@submission, :html => { :multipart => true, :id => "fileupload" }) do |f| %> <%= f.file_field :package1%> <%= f.file_field :package2%> <% end %> The problem is that paperclip will insert two separate entries for each file in the database. However, I want it to insert into only one entries since I have two

Resize missing.png depending upon style in paperclip

一世执手 提交于 2019-12-06 07:20:13
问题 I'm using Paperclip to upload a image here my paperclip configuration has_attached_file :avatar, :path => ":rails_root/public/users/:id/avatar/:style/avatar.jpg", :url => "/users/:id/avatar/:style/avatar.jpg", :default_url => "/missing/users/:style/missing.png", :styles => {"47x47" => "47x47", "228x228" => "228x228","185x176"=>"185x176","pitch_planner"=>"262x129!"}, :convert_options => {"47x47" => "-background black -gravity center -extent 47x47", "228x228" => "-background black -gravity

pass file to paperclip on back end [rails]

落爺英雄遲暮 提交于 2019-12-06 06:27:51
I am using paperclip to attach multiple files to a Entry object Class Asset < ActiveRecord::Base belongs_to :entry has_attached_file :asset, ... Works wonderfully when user is uploading files via a nested form. However, I have certain instances in which a file is uploaded not via the input form but as a result of a flash audio recorder. Audio is recorded and uploaded asynchronously to my /tmp folder. So I end up with some files on my server that have not been uploaded via paperclip. In these cases, I'd like to take the file and pass it to paperclip to be handled as if it were uploaded by a

cannot save image by paperclip in rails on windows 8

喜夏-厌秋 提交于 2019-12-06 06:19:32
I use "paperclip", "~> 4.1" (on windows 8) to save picture to my product. I have below code: products_controller: class ProductsController < ApplicationController before_action :set_product, only: [:show, :edit, :update, :destroy] def index @products = Product.all end def show end def new @product = Product.new end def edit @product = Product.all end def create @product = Product.new(product_params) respond_to do |format| if @product.save format.html { redirect_to @product, notice: 'Product was successfully created.' } format.json { render action: 'show', status: :created, location: @product }

Rounded corners with Paperclip

不羁的心 提交于 2019-12-06 05:17:19
问题 How do you create rounded corners with Paperclip? I have found this solution which creates rounded corners with paperclip using convert_options, but it does not work with Rails 3 and Paperclip 2.4.5. The generated convert command works only if I use the ImageMagick alpha parameter instead of the threshold paramter: convert example.jpg \ \( +clone -alpha extract \ -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \ \( +clone -flip \) -compose Multiply -composite \ \( +clone