Displaying 18 results from an estimated 18 matches for "validates_as_attach".
2007 Sep 18
2
Making attachment_fu polymorphic
...at the same time. Maybe.
## 2. Mix in Attachment_kung to whatever Model(s) you want to have
the attachments and configure them as
## you normally would for attachment_fu,except use
has_polymorphic_attachment instead of
## has_attachment and validates_as_polymorphic_attachment instead
of validates_as_attachment.
## Write the configuration params just as you normally would. For
more info on
## setting up attachemnt_fu see Mike Clark''s excellent tutorial:
## http://clarkware.com/cgi/blosxom/2007/02/24
## 3. Give your Attachment_kung-ed Model the correct has_many for
polymorphis...
2007 Apr 27
3
attachment_fu content_type problem
...:Base
belongs_to :tournament, :polymorphic => true
has_attachment :content_type => [''application/pdf'', ''application/
msword'', ''text/plain''],
:storage => :file_system,
:max_size => 1.megabyte
validates_as_attachment
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this gr...
2007 Aug 22
8
How to spec an attachment_fu model
First off, I''m not trying to spec attachment_fu, I know it''s been tested.
But, I added some code to that model that I do need to test. Basically,
I need to somehow fulfill the "uploaded_data" property so I can actually
run my tests(otherwise they fail because of validations). The
"uploaded_data" field is what would grab the multipart data from form.
Here
2008 Jul 24
1
Automating a ruby script
...''script/parser file.txt''. I am using the
''attachment_fu'' plug-in to upload the text file to my public folder
(admittedly not the best place to keep raw data, but I will work that
out in time). Once I have that file uploaded, and verified it using
the ''validates_as_attachment'', how do I get the script to
automatically parse the file?
Would it be possible to create a helper that runs a console command?
It seems possible, but not the best way. Does anyone have a better
idea?
Thank you so much for any help you can give. I have been racking my
brain trying...
2010 Apr 24
2
problem using attachment_fu with S3
...to an application that works.
i have attached my db file.
in my model I have
has_attachment :content_type => :image, :storage => :s3, :size =>
0.megabyte..3.megabytes, :resize_to => ''450x450>'', :thumbnails => {
:thumb => ''150x150>'' }
validates_as_attachment
my view new
<h1>New upload_file</h1>
<%= error_messages_for :upload_file %>
<% form_for(:upload_file, :url => upload_files_path, :html => {
:multipart => true }) do |form| %>
<p>
<label for="uploaded_data">Upload a file:</label>...
2007 Mar 28
3
attachment_fu Not Resizing
...has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 18.megabytes,
:resize_to => ''300x'',
:thumbnails => { :thumb => ''61x110!'' }
validates_as_attachment
end
I expected a 420x595 image to be resized to 300xWhatever and a 61x110
thumbnail to be created. The image and thumbnail product records
were both created in the database but the images were left at the
original size.
Strangely the width and height fields in the database are no longe...
2007 Apr 08
13
attachment_fu thumbnail not created
...:storage => :s3,
:max_size => 500.kilobytes,
:resize_to => ''150x150>'',
:thumbnails => { :thumb => ''40x40>'' },
:processor => ''Rmagick''
validates_as_attachment
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group,...
2007 May 07
1
attachment_fu seems to be searching the wrong location for my images
...his)
:storage => :file_system, #Store
files in the filesystem
:max_size => 1.megabyte, #Maximum
image size, 1Mb
:thumbnails => {:thumb => ''120x90''} #Create one
thumbnail 120x90
validates_as_attachment
end
In my Product model, I have a method to return the file path for
simplification or a stock image if not found:
def photo_filename
retval = "/images/no_image.gif"
unless not photo.nil? then
retval = photo.public_filename
end
retval
end
For some reason...
2006 Jun 11
2
Problem with Acts_As_Attachment
Hi,
I have installed the acts_as_authenticated plugin from technoweenie, but
when I run the tests I get an error (running windoze)
-- create_table(:attachments, {:force=>true})
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'':
no
such file to load -- sqlite (MissingSourceFile)
I found the require statement in test/abstract_unit.rb
2007 May 05
0
acts_as_attachment - no thumbnails?
...l like this:
class EventPic < ActiveRecord::Base
belongs_to :event
acts_as_attachment :storage => :file_system, :max_size =>
900.kilobytes, :content_type => :image, :thumbnails => { :normal
=> ''800>'', :thumb => ''150x150'' }
validates_as_attachment
end
and a controller something like:
....
@event = current_user.events.find(params[:id])
(1..3).each { |p|
pic = ''pic''+p.to_s
@event.pics << EventPic.new(params[pic]) unless params[pic]
[:uploaded_data] == ""
}
@event.save!
....
2007 Dec 02
0
attachment_fu doesn't generate thumbnails on windows
...:processor => ''Rmagick'',
:max_size => 6.megabytes,
:resize_to => ''100x100>'',
:thumbnails => { :thumb => ''30x30>'', :tiny => ''10x10>''
}
validates_as_attachment
end
Is there something I''m missing here?
Cheers
Shaun
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this gr...
2008 Jul 30
0
Halt file upload if maximum size is reached. Is that possible?
...d for an way to do the same _during_ the file
upload. Using flash it''s apparently possible, but I don''t want to use
flash.
One way to do it is via Apache configuration.
But, is there any other way to stop the transfer?
I considered attachment_fu, which says in its config:
"validates_as_attachment -- This method prevents files outside of the
valid range (:min_size to :max_size, or the :size range) from being
saved. It does not however, halt the upload of such files. They will
be uploaded into memory regardless of size before validation."
So, in attachment_fu, this isn''t...
2008 Sep 25
1
Will acts_as_paranoid work with attachment_fu?
...39;application/msword'', ''text/plain'', ''application/vnd.ms-excel'',
''application/msexcel'', ''application/octet-stream''],
:max_size => 5.megabytes
belongs_to :documentable, :polymorphic => true
validates_as_attachment
end
class SupportingDocument < Document
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to...
2013 Jun 28
1
[HELP PLEASE!] attachment_fu and aws-s3
...content_type => :image,
:storage => :s3,
:max_size => 1.megabyte,
:thumbnails => {
:thumb => ''145x145>'',
:normal => ''480x360>''
}
validates_as_attachment
amazon_s3.yml
development:
bucket_name: ''mybucket''
access_key_id: ''my_access_key''
secret_access_key: ''my_secret_key''
test:
bucket_name:
access_key_id:
secret_access_key:
production:
bucket_name:
access_key_id:
secret_a...
2008 Sep 29
1
has_one :through with :source. How to alias association?
...#39;'../private/attachments'',
:storage => :file_system,
:processor => :rmagick,
:thumbnails => { :small => ''32x32'', :medium =>
''64x64'', :large => ''256x256'' }
validates_as_attachment
belongs_to :attachable, :polymorphic => true
end
class Maker < ActiveRecord::Base
validates_presence_of :name, :on => :create, :message => "can''t be
blank"
validates_uniqueness_of :name, :message => ''name must be unique''
validates_p...
2007 Jun 29
1
attachment_fu validation error
...:storage => :db_file,
:max_size => 500.kilobytes
:thumbnails => {:web => ''150x100'', :pdf =>
''150x100''},
:processor => ''MiniMagick''
validates_as_attachment
end
OK, logos are working great in the application, resizing, storage,
retrieval, ..., fine. But the validation of existing logos fails with
(complete trace below)
Logo.find(:first).valid?
NameError: undefined local variable or method `full_filename'' for
#<Logo:0x35...
2006 Nov 20
7
Acts as attachement
Hi guys
Question about acts as attachment still getting the following error
undefined method `content_type''
I have set everything up according to the following page however i am
still have trouble
http://weblog.techno-weenie.net/articles/acts_as_attachment
One thing, I have wanted to add this to an existing model in my system.
I have not used the...
script/generate
2006 Sep 08
4
Does acts_as_attachment :storage => :db_system work?
I found the post about needing to install acts_as_attachement_1_1_6 if
you are not on edge rails. But I am having trouble getting db_system
storage to work. As far as I can tell in from the database, things are
working, but I don''t see how my model table hooks up with the db_files
table so I am having trouble altering the image_tag from the tutorial