search for: store_dir

Displaying 20 results from an estimated 22 matches for "store_dir".

2006 Jan 04
4
file_column
I use file_column and it works fine. I tried to change the store_dir to a the path I want my files to be stored and not the default. I stored some images fine. But when I try to reach my images it seems like file_column uses the model_name/attribute_name on the image and not the store_dir I used. How can I change this ? Thanks in advance -- Alexander Antonakakis
2006 Jan 17
0
file_column with both root_path and store_dir
I store my file_column database outside of my RAILS_ROOT. It seems to work in real life, but not in tests. In the tests, I can''t set both the root_path and the store_dir. In tests, setting the store_dir option will override the root_path option. The only way for root_path to work is to remove store_dir. I think the problem is in file_column.rb on line 22: options[:store_dir] ||= File.join(options[:root_path], model, attr) Here''s my test: def...
2006 Apr 14
1
file_column and custom store_dir
I''m using file_column to store mulitple versions of an image in a custom directory "images/artwork/" with the :store_dir option. This is working fine for uploading and storing the images, but whenever I try and access the images with the url_for_file_column helper it keeps generating the default path. I thought it would replace this by default, but it doesn''t seem to. I can hand code these in, but it seems...
2005 Nov 18
10
[Request] file_column configurability
I wasn''t sure where to email this request, so I am hoping the author of file_column actually sees this. I was wondering if there were any plans to allow some configurability in the file_column plugin. By configurability I mean allowing the developer to define which table column is used as the unique identifier when creating image folders. Right now it seems like it uses the ID of the
2006 Feb 20
2
file_column: changing default store_dir
File_column plugin is great. I need to change the default :store_dir from the dynamic "model_name/attribute_name" to an equally dynamic "client_id/app_id/model_name/attribute_name". In my model I have: class Component < ActiveRecord::Base belongs_to :component_type belongs_to :component_group breakpoint file_column :content,...
2006 Jun 28
6
file_column plugin. Storing files outside RAILS_ROOT
I also posted this on Rails Engines forum. Sorry for the double post. I am trying to configure file_column plugin so that it stores the images in a directory completely outside of RAILS_ROOT. I have no problems in storing the files by setting :root_path option. But I can''t get to display these images using ''url_for_file_column''. What I get instead of the image is
2006 Mar 02
2
url_for_file_column not returning correct path
...file_column plugin: def test_url_for_file_column_different_root_path Entry.file_column :image, :root_path => File.join(RAILS_ROOT, "public/files") e = Entry.new(:image => upload(f("skanthak.png"))) assert_match %r{/public/files/entry/image}, e.image_options[:store_dir] assert e.save assert_match %r{files/entry/image}, url_for_file_column(e, "image") end the last assert_match did not pass... 1) Failure: test_url_for_file_column_different_root_path(UrlForFileColumnTest) [file_column_helper_test.rb:59]: <"/entry/image/1/skanthak.png&...
2005 Dec 23
6
file_column and HABTM
I have several models that will be using file_column by way of the "Picture" class (HABTM). Right now, all pictures are stored in: public/picture/image/1/filename1.jpg public/picture/image/2/filename2.jpg Is there a way I can dynamically define the "store_dir" based on the model? For example, if I have "user", "product" and "place" models all of which HATBTM "picture", I''d like uploads to be located in: public/picture/user/1/filename.jpg ## user pic public/picture/product/6/filename.jpg ## produc...
2006 Mar 23
5
Filecolumn storage location
Hi, I am using file_column for some image uploading. I want to have all the images stored under one root which I have managed by setting the :store_dir option as below. file_column :filename, :store_dir => File.join(RAILS_ROOT, ''public'', ''images'', ''products'') So, my images get uploaded to: /public/images/products/<primary_key> That''s fine. But none of my links to the image...
2006 Jun 10
0
Dynamic file paths in FileColumn
...ml.new(@params[:xml]) @xml.save end class Xml < ActiveRecord::Base file_column :path, {:pub => :publication_id} end #small change to FileColumn (appologies to Mr. Kanthak) module FileColumn # :nodoc: ... def self.init_options(defaults, attr) options = defaults.dup options[:store_dir] ||= File.join(options[:root_path], options[:pub]) options[:tmp_base_dir] ||= File.join(options[:store_dir], "tmp") options[:base_url] ||= options[:web_root] + File.join(attr) FileUtils.mkpath([ options[:store_dir], options[:tmp_base_dir] ]) options end ... def file_...
2006 Jul 03
1
staying in control over the case in file_column plugin
...mb.jpg, etc. This is tacky in terms of my counting on a consistency when implementing views. My inclination is to start hacking away at this section of file_column.rb: class PermanentUploadedFile < RealUploadedFile # :nodoc: def initialize(*args) super *args @dir = File.join(store_dir,@instance.id.to_s) @filename = @instance[@attr] @filename = nil if @filename.empty? end something like @filename = @instance.lower[@attr] instead of @filename = @instance[@attr] but before I start hacking brilliantly conceptualized code with illogical luck, I wonder if...
2006 Mar 16
2
Questions about file_column plugin
Hi! I''ve got 2 models - let''s call them User and Image. User has_many images. (Thanks to Mark Reginal James :) ) I have a single form where i can create a user and add to him any number of images, which are uploaded using file_column plugin. Now 3 questions: 1. How to change the default path where file_column plugin saves images, so it will save them in a directory, which
2005 Dec 29
3
FileColumn Help
i''ve changed store_dir to :store_dir => "public/uploads/users/pictures/" that works great for uploading, but url_for_file_column is still outputting: /user_picture/image/id/name.jpg how do i make url_for_file_column output the correct url? -- Posted via http://www.ruby-forum.com/.
2006 Jan 09
7
File_column Dynamic directory
...arlier and did recieve an answer but I am not sure Ifully understood the answer as I am getting all sorts of errors when trying to implement. Basically I want to add a layer to the path for my files. I have the following set up in my model class: file_column :image, :store_dir => :dynamic_dir def dynamic_dir File.join(field_options[:root_path], "picture",@user.username, "image") end When I run the app I recieve the following error: undefined method `to_str'' for :dynamic_dir:Symbol This is the code that Kyle sent me in re...
2006 Apr 14
5
state_models plugin and file_column?
I was looking at Kyle Mawell''s extremely nifty-looking StateModels plugin http://www.kylemaxwell.com/articles/2006/02/06/fun-with-single-table-inheritance and before I go down the road with it, I was wondering if anyone has used it with file_column. The way file_column deals with an uploaded file -- by storing it to the filesystem in a path that employs the model name and id --
2005 Dec 20
3
File Column Directory Add another layer
Quick Question. I understand how to change the default path to something other than public but what if I wanted to add another directory into the equation. I want to upload an image into the following structure: /public/image/userid/imageid/test.gif So basically I want to look up the userid in my users table and put all the images for that user in the same directory. So i have a one
2006 Mar 02
2
How to get mime extension with file_column
Is there a way to get the MIME extension of a file_column field? Here''s what I want to do (look for comment in before_save method): class ProductFile < ActiveRecord::Base belongs_to :product file_column :file_name def before_save self.file_type = # something that returns the MIME type (e.g. image/jpeg) end end TIA
2006 Feb 26
0
file_column issues
...am having some strange issues with file column today. This goes back to something that I was working on before and successfully have it working on my development box however it is not working on my staging machine. I have a dynamic_dir action set up for file_column that is called via the :store_dir => :dynamic_dir the action is this: def dynamic_dir File.join("data","files",self.user_id.to_s,"image") end This works perfect on my development machine however when I loaded the code up to our staging machine (getting ready to go live with it) I ke...
2006 Aug 23
0
Rotating Images with file_column
...er file_columm''s auto-generation function without "reuploading" the image? Or better yet: is there a clean way to represent the image "versions" (which would consist of dimensions and cropping) which I can plug into the file_column and RMagick? file_column :image, :store_dir => :photo_store_dir, :magick => { :versions => { :small_thumb => { :crop => ''1:1'', :size => ''40x40>'' }, :large_thumb => { :crop => ''4:3'', :size => ''100x75>'' }, :small =>...
2006 Aug 04
1
file_column issues on dreamhost
...my local dev machine using webrick. On dreamhost i have no errors, but initially the uploaded images where stored in /public/user/...etc... When the image should have displayed I just got the filename instead. I though it might be a routing issue, so I tweaked the file_column.rb to: options[:store_dir] ||= File.join(options[:root_path], "/images", model, attr) This got the uploaded images storing into /public/images/user/...etc... I also changed file_column_helper.rb to: url << @request.relative_url_root.to_s << "/images/" That should accomidate for the displ...