Forum: Ruby on Rails file_column content type

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Adam D. (Guest)
on 2006-01-09 23:21
(Received via mailing list)
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
Kyle M. (Guest)
on 2006-01-09 23:24
(Received via mailing list)
On 1/9/06, Adam D. <removed_email_address@domain.invalid> wrote:
>
http://opensvn.csie.org/rails_file_column/plugins/...

--
Kyle M.
Chief Technologist
E Factor Media // FN Interactive
removed_email_address@domain.invalid
1-866-263-3261
Adam D. (Guest)
on 2006-01-10 05:00
(Received via mailing list)
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
Sebastian K. (Guest)
on 2006-01-10 12:33
(Received via mailing list)
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/...

Hope this helps
Sebastian
Brandon (Guest)
on 2006-02-14 01:59
> 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/...

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.
John A. (Guest)
on 2006-02-14 02:08
(Received via mailing list)
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:

<p><label for="home_images_filename">File</label><br/>
<%= file_column_field("home_images", "filename") %></p>


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
This topic is locked and can not be replied to.