File_column content type


#1

is there a way using the file_column plugin to enforce a certain
content type based on regex (i.ie, /^image/) and/or filesize (150k)
?

thanks
adam


#2

On 1/9/06, Adam D. removed_email_address@domain.invalid wrote:

http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk/lib/validations.rb


Kyle M.
Chief Technologist
E Factor Media // FN Interactive
removed_email_address@domain.invalid
1-866-263-3261


#3

thanks. now for an even dumber question. Isnt rails supposed to
automatically load the vendor directory ? I installed file_column
but i get a

undefined method `file_column’ for #<#Class:0x40847dc0:0x40847aa0>
when using it in the model

cant seem to find where to “require” file_column if thats necessary.

adam


#4

On 1/10/06, Adam D. removed_email_address@domain.invalid wrote:

thanks. now for an even dumber question. Isnt rails supposed to
automatically load the vendor directory ? I installed file_column
but i get a

undefined method `file_column’ for #<#Class:0x40847dc0:0x40847aa0>
when using it in the model

cant seem to find where to “require” file_column if thats necessary.

file_column is designed as a plugin. This means you should just drop
it into vendor/plugins/file-column or install it via

./script/plugin install
http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk

Hope this helps
Sebastian


#5

file_column is designed as a plugin. This means you should just drop
it into vendor/plugins/file-column or install it via

./script/plugin install
http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk

I have this same problem. I’ve run the command and file_column is now
sitting in my plugins folder. I tried restarting the webserver, but I
still get this error:

undefined method `file_column’ for HomeImagesController:Class

And my controller looks like this:
class HomeImagesController < ApplicationController
#model :home_images # does this matter?
file_column :filename
end

Do I need to “require” the plugin anywhere? It looks like it doesn’t
recognize that it exists.


#6

Your file_column :filename should be in your Model, not your controller.

class HomeImages < ActiveRecord::Base
file_column :filename
end

Step 2 is to change your new and edit views to include :multipart =>
true, like this:

<%= start_form_tag ({:action => ‘create’}, :multipart => true) %>

After that, edit your _form partial to have the helper called:

File
<%= file_column_field("home_images", "filename") %>

You also shouldn’t need to call out your model unless rails is
choking on it.

Enjoy!
-J

On Feb 13, 2006, at 6:59 PM, Brandon wrote:

still get this error:
Do I need to “require” the plugin anywhere? It looks like it doesn’t
recognize that it exists.

John A.
removed_email_address@domain.invalid

Meticulous | www.meticulous.com (work)
Rotoscope | www.rotoscope.com (sound: rock band)
Boboroshi & Kynz | www.boboroshiandkynz.com (sound: electronic)
Personal Weblog | www.boboroshi.com (play)

“Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.”
- Benjamin Franklin (1706-1790)
Reply of the Pennsylvania Assembly to the
Governor
November 11, 1755