Displaying 20 results from an estimated 56 matches for "has_attached_file".
2008 Jun 09
10
Testing file attachment with Paperclip
Does someone have an example on faking a file upload for just ensuring
it gets called, without actually uploading the file to s3.
I thought that stubbing Model.has_attached_file would be enough, but
it doesn''t seem so ...
This is what I did:
Video.stub!( :has_attached_file ).with( :name ).and_return( true )
has_attached_file is from paperclip, it gets mixed to the model.
1)
RightAws::AwsError in ''VideosController should create a valid Video''...
2010 Sep 01
1
Faking Paperclip has_attached_file with Factory girl?
Hello!
I wonder if it''s possible to simulate Paperclip''s has_attached_file
with Factory Girl and then test it with Rspec. I don''t get it to work.
My factories.rb file looks like this:
Factory.define :user do |user|
user.name "Anders"
user.email "user-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org"
user.password...
2010 Feb 15
4
Changing the :path and :url options of has_attached_file in paperclip
Hello,
I am using the paperclip plugin to upload images and it works
absolutely fine.
I intend to save my uploaded images to C:\Application_name\public
folder. Accordingly, with some study over the i-net, I changed
the :path option of has_attached_file to -
:path => "C:/Application_name/
public/:class/:attachment/:id/:style_:basename.:extension"
Now, the files are being saved to the desired path. However, I need to
understand what should be the corresponding change in the :url option.
I tried everything -
:url => "/:id/:s...
2010 Mar 17
3
Associating a default paperclip image from a different model
Here''s some code, this is my NewsItem model as you can see...
class NewsItem < ActiveRecord::Base
belongs_to :country
has_attached_file :image, :styles => { :original => ''57x57'' },
:default_url => ''/images/football.png''
# has_attached_file :image,
# :styles => { :original => ''57x57'' },
# :default_url => self.coun...
2011 Jan 03
2
Adding style to model (paperclip)
hello,
I have a model (item) with one attachment (photo) and one style (small):
class Producto < ActiveRecord::Base
has_attached_file :photo, :styles => { :small => "50x50"},
end
I would like to add a new style (:large), so I modify item.rb:
class Producto < ActiveRecord::Base
has_attached_file :photo, :styles => {{ :small => "50x50"},{ :large =>
"150x150"}}
end
it seems to be...
2009 Jul 07
2
paperclip unit testing
Hi,
Rails 2.3.2, paperclip 2.2.9.2
How can I unit test my model that has a paperclip attachment?
I add to my model:
--- CODE START ---
has_attached_file :image, :default_url => ''''
attr_protected :image_file_name, :image_content_type, :image_image_size
--- CODE END ---
Than I type a UNIT test:
--- CODE START ---
foo=FooModel.new({:image => File.new(''test/fixtures/img/an_image.gif'')})
--- CODE END ---
This...
2010 Aug 08
2
paperclip save to disk and s3
I have a standard Paperclip setup that saves a file to my disk. In
addition I would also like the file saved to my amazon s3 bucket.
[code]
after_save :copy_to_s3
def copy_to_s3
has_attached_file :photo,
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:styles => {
:thumb => "100x100#",
:small => "750x750>" }
end
[/code]
This is giving the error: undefined method `has_attached_file''
--
Posted via...
2009 Sep 03
12
paperclip is not saving the files
Hi all,
I''ve installed paperclips but
paperclip is not saving the files
my model has
has_attached_file :attachment,:styles => { :medium => "300x300>",
:thumb => "100x100>" }
and i have db migration as
class AddAttachmentToPolicies < ActiveRecord::Migration
def self.up
add_column :policies, :attachment_file_name, :strin...
2012 Aug 18
2
Paperclip images are not stored in my directory
It is my User.rb model,
My images are not stored in my assets directory..
has_attached_file :photo, :styles => { :small => "100x100#", :large =>
"500x500>", :thumb => "60x60>" },
:url => "/assets/users/:id/:style/:basename.:extension",
:path =>
":rails_root/public/assets/users/:i...
2011 May 14
0
Undefined method `has_attached_file' with paperclip 2.3.8 gem for Rails 2 using Ruby 1.8.7
....3.8 gem from rubygems.org.The
undefined method error still persisted, I really couldn''t figure out
why.
Now here.. the command `ruby script/generate paperclip group_post
photo` worked perfectly fine for me.
The current error I am getting exactly looks like this:-
undefined method `has_attached_file'' for #<Class:0xb67119f0>
The **Application Trace** for the same is:-
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in
`method_missing_without_paginate''
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in...
2008 Sep 02
4
Attachment_fu, Paperclip, & S3
...across, but, they don''t seem to work; I''m probably
sending them incorrectly because visually obvious options, like
''rotate'', clearly don''t do anything (or throw any errors, either). Does
anyone know what I''m doing wrong here (?);
# Attempt no.1
has_attached_file :avatar, :convert_options => { :rotate => "-rotate
-90" },
:styles => {
:thumb_45 => ''45x45#''....
# Attempt no.2
:convert_options => { :rotate => "-rotate ''-90''" }
# Attempt no.3
:convert_options => { :rotate =>...
2009 Sep 10
2
Paperclip attachment to AWS - ActiveRecord::AssociationTypeMismatch
...Notice < ActiveRecord::Base
has_many :graphics
end
--Project Controller
def create_notice
@notice = Notice.create(params[:notice])
end
--Form
<%= form.file_field(:graphic) %>
--Graphic
class Graphic < ActiveRecord::Base
belongs_to :notice
attr_accessor :notice_id
has_attached_file :graphic,
:storage => :s3,
:s3_credentials => RAILS_ROOT + "/config/
s3.yml",
:path => ":attachment/:id/:style.:extension",
:bucket => "attachements"
end
Thanks!
2010 Apr 01
2
paper clip plugin error
...command.
having window xp
C:\Program Files\ImageMagick-6.4.5-Q16 this image magick installed
development.rb file cod
-----------------------------------------
Paperclip.options[:image_magick_path] = "C:/Program Files/
ImageMagick-6.4.5-Q16/www"
model code
----------------------------
has_attached_file :photo ,
:styles => {
:thumb=> "100x100#",
:small => "150x150>",
:medium => "300x300>",
:large => "400x400>" }
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: T...
2010 Feb 14
2
paperclip is making me crazy
seems pretty simple, my model...
has_attached_file :pic_1, :styles => { :thumb => "120x90" },
:url => "/:attachment/:id_:style.:extension",
:path => ":rails_root/public/system/:attachment/:id_:style.:extension"
my view...
<% form_tag(:action => ''create'', :html => { :multipar...
2013 Oct 10
12
What's the best way to approach reading and parse large XLSX files?
...XLSX files were uploaded:*
require ''roo''
require ''spreadsheet''
require ''creek''
class UploadFiles < ActiveRecord::Base
after_commit :process_files
attr_accessible :inventory, :material_list
has_one :inventory
has_one :material_list
has_attached_file :inventory, :url=>"/:current_user/inventory",
:path=>":rails_root/tmp/users/uploaded_files/inventory/inventory.:extension"
has_attached_file :material_list, :url=>"/:current_user/material_list",
:path=>":rails_root/tmp/users/uploaded_files/material...
2011 May 10
0
paperclip
Estou tendo problemas com o plugin paperclip numa aplicação que criei
só para testa o plugin
da a seguinte mensagem quando inicio o servidor !
undefined method `has_attached_file ''for # <Class:0x473f598>
Meu model esta assim, se eu comenta ele a aplicação roda.Já instalei
esss plugin umas 20 vezes e nada
estou usando o ruby 1.9.2 e rails 3.desde já agradeço a ajuda.
class Person < ActiveRecord::Base
has_attached_file :resume
end
Julio César
--
You...
2011 May 28
4
Rais 3, nested attributes problem with paperclip
I have two models, one model girl and one girl_photos (a file upload
asset). The only code I have in models which describes the association
is:
For the girl => belongs_to :girl and has_attached_file :photo
For the model girl_photos => has_many :girl_photos and
accepts_nested_attributes_for :girl_photos
I''ve tried to save as a nested attribute the photo, it saves the
association in the database but it doesn''t set the name of the image
and doesn''t upload it.
I th...
2011 Aug 07
2
PROBLEM WITH PAPERCLIP
...ncluded gem paperclip
2.In config/environments /development.rb => Paperclip.options[:command_path]
= "/usr/bin/" (convert path)
3.created a controller *picusers *and defined => def create
@picuser = Picuser.create(params[:picuser])
end
4.created a model *picuser *with =>has_attached_file :avatar, :styles =>
{:medium => "300*300>", :thumb => "100*100>" }
created a migration file with following columns => class
AddAvatarColumnsToPicusers < ActiveRecord::Migration
def self.up
add_column :picusers, :avatar_file_name, :string
add_...
2010 Aug 21
3
Cleanly handling sub-generatede files with Paperclip
Hi,
Let''s say I upload a pdf file. Imagemagick extracts all pages out of it
and stores the png images on the hard-drive. How to easily handle all
these generated files with Paperclip?
Has anyone done that before? Thanks for your advice
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2009 Sep 09
1
Paperclip attachment to AWS - ActiveRecord::AssociationTypeMismatch Going Nuts!
...t; ActiveRecord::Base
has_many :graphics
end
--Project Controller
def create_notice
@notice = Notice.create(params[:notice])
end
--Form
<%= form.file_field(:graphic) %>
--Graphic
class Graphic < ActiveRecord::Base
belongs_to :notice
attr_accessor :notice_id
has_attached_file :graphic,
:storage => :s3,
:s3_credentials => RAILS_ROOT + "/config/s3.yml",
:path => ":attachment/:id/:style.:extension",
:bucket => "attachements"
end
Thanks!
-J
-...