# File\_column plugin error

**URL:** <https://www.ruby-forum.com/t/file-column-plugin-error/61811>\
**Category:** Rails\
**Created:** [January 16, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811 "2006-01-16T18:34:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [January 16, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/1 "2006-01-16T18:34:51Z")

</div>

Hi,

I downloaded FileColumn plugin and love the concept.  
But when I tried the example listed on the plugin web  
site, I got the following  
error:

```
 NoMethodError in Entry#new

 undefined method `file_column' for Entry:Class

```

My environement is Red Hat linux 9.0 with mysql 4.1. I  
installed file\_column under vendor/plugins. If I run  
“ls”, I get the following directories:  
file\_column rails\_file\_column

I created a directory, " file\_column" and copied files  
under “trunk” to file\_column.

Please see my controller, models and new.rhtml  
attached.

Could anyone tell me why I got the error? It seems  
that rails can not  
find “file\_column” plugin.

Thanks in advance.

–  
-Thomas

entry.rb:  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

entry\_controller.rb:  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
class EntryController \< ApplicationController

# Get information on a new product and

# attempt to create a row in the database.

def create  
@entry = Entry.new(@params[:entry])  
if @entry.save  
flash[‘notice’] = ‘Entry was successfully  
created.’  
redirect\_to :action =\> ‘list’  
else  
render\_action ‘new’  
end  
end

def list  
@entry\_pages, @entries = paginate :entry,  
:per\_page =\> 10  
end

# Initiate the creation of a new product.

# The work is completed in #create.

def new  
@entry = Entry.new  
end

end

Error:  
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
NoMethodError in Entry#new

undefined method `file\_column’ for Entry:Class

RAILS\_ROOT: ./script/…/config/…/  
Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:991:in  
`method_missing' #{RAILS_ROOT}/app/models/entry.rb:4 /home/txue/downloads/rails-code/depot.0114/app/controllers/entry_controller.rb:21:in`new’

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:991:in  
`method_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:in`load’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:207:in  
`load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:39:in`require\_or\_load’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:22:in  
`depend_on' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:178:in`require\_dependency’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:178:in  
`require_dependency' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:194:in`const\_missing’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/base.rb:853:in  
`send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in`perform\_action\_without\_filters’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/filters.rb:332:in  
`perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/benchmarking.rb:69:in  
`measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/rescue.rb:82:in  
`perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in`send’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/base.rb:369:in  
`process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in

`dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:in`handle\_dispatch’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick\_server.rb:83:in  
`service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in`service’  
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in  
`run' /usr/local/lib/ruby/1.8/webrick/server.rb:155:in`start\_thread’  
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in  
`start' /usr/local/lib/ruby/1.8/webrick/server.rb:144:in`start\_thread’  
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in  
`start' /usr/local/lib/ruby/1.8/webrick/server.rb:89:in`each’  
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in  
`start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:in`start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in  
`start' /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:in`dispatch’  
script/server:51

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:991:in  
`method_missing' #{RAILS_ROOT}/app/models/entry.rb:4 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:in`load’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:207:in  
`load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:39:in`require\_or\_load’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:22:in  
`depend_on' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:178:in`require\_dependency’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/dependencies.rb:178:in  
`require_dependency' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:194:in`const\_missing’  
/home/txue/downloads/rails-code/depot.0114/app/controllers/entry\_controller.rb:21:in  
`new' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in`send’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/base.rb:853:in  
`perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in`perform\_action\_without\_benchmark’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in`measure’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in`perform\_action’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/base.rb:369:in  
`send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in`process\_without\_session\_management\_support’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action\_controller/session\_management.rb:116:in  
`process’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in

`dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:in`handle\_dispatch’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick\_server.rb:83:in  
`service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in`service’  
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in  
`run' /usr/local/lib/ruby/1.8/webrick/server.rb:155:in`start\_thread’  
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in  
`start' /usr/local/lib/ruby/1.8/webrick/server.rb:144:in`start\_thread’  
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in  
`start' /usr/local/lib/ruby/1.8/webrick/server.rb:89:in`each’  
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in  
`start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:in`start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in  
`start' /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:in`dispatch’  
script/server:51

This error occured while loading the following files:  
entry.rb

Request

Parameters: None

Show session dump

* * *

flash: !ruby/hash:ActionController::Flash::FlashHash  
{}

Response  
Headers: {“cookie”=\>[], “Cache-Control”=\>“no-cache”}

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [January 16, 2006, 7:14pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/2 "2006-01-16T19:14:03Z")

</div>

On Monday 16 Jan 2006 17:32, Tom G wrote:

> Could anyone tell me why I got the error? It seems  
> that rails can not  
> find “file\_column” plugin.

Hi Tom,

Having just set this up on a project today, here’s what worked for me:

cd /path/to/my/rails/app  
./script/plugin install [http://opensvn.csie.org/rails\_file\_column/](http://opensvn.csie.org/rails_file_column/)

Then, after that:

cd /vendor/plugins/rails\_file\_column/plugins/  
mv file\_column/ …/…/  
cd …  
rmdir plugins  
cd …  
rmdir rails\_file\_column/

To be honest, I was just moving it for the sake of neatness (didn’t like  
the  
deep nesting) but it seems to have worked, so no problems here.

One other thing I noticed that I can’t seem to find documented anywhere,  
is  
that the…

\<%= image\_tag url\_for\_file\_column “model\_name”, “column\_name” %\>

… stuff wasn’t working, since it was returning a path that didn’t  
exist.

The path being returned included “development”, eg:

/model\_name/column\_name/development/2/image\_name.jpg

… when the actual path to the file was:

/model\_name/column\_name/2/image\_name.jpg

… so what I did to address this was to go to my  
/model\_name/column\_name  
directory (inside public), and type:

ln -s . development

… which fixed it, but seems to be a slightly kludgy thing to do (and I  
have  
no idea what Windows users could do about this problem, but that’s not  
my  
concern).

Anyway, it’s working now, and this is for such a simple site that I’m  
not  
looking to spend long working out why some things are a little bit weird  
with  
the plugin! The rmagick integration creating multiple resized versions  
is  
particularly sweet - I’m a happy little code monkey! 😉

~Dave

–

Dave S.  
Rent-A-Monkey Website Development  
Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [January 16, 2006, 7:53pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/3 "2006-01-16T19:53:15Z")

</div>

Thanks Dave a couple of litte nits

> cd /vendor/plugins/rails\_file\_column/plugins/

should be:

cd vendor/plugins/rails\_file\_column/plugins/

I also had to “mv vendor/plugins/file\_column/tags/rel\_0-3-1/\* vendor/  
plugins/file\_column”

However I am still getting this when I try to display an uploaded image:

undefined method `url\_for\_file\_column’ for #Entry:0x250a82c

Any ideas?

On Jan 16, 2006, at 10:11 AM, Dave S. wrote:

> ./script/plugin install [http://opensvn.csie.org/rails\_file\_column/](http://opensvn.csie.org/rails_file_column/)  
> To be honest, I was just moving it for the sake of neatness (didn’t  
> exist.  
> column\_name  
> Anyway, it’s working now, and this is for such a simple site that
> 
> Dave S.  
> Rent-A-Monkey Website Development  
> Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

- Bill

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [January 17, 2006, 1:27am UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/4 "2006-01-17T01:27:47Z")

</div>

On Monday 16 Jan 2006 18:50, Bill P. wrote:

> Thanks Dave a couple of litte nits  
> should be:  
> cd vendor/plugins/rails\_file\_column/plugins/

D’oh, well spotted! I cobbled together a few lines from my  
.bash\_history (to  
make the instructions more concise) and I guess I mis-typed or  
mis-pasted  
that one.

> I also had to “mv vendor/plugins/file\_column/tags/rel\_0-3-1/\* vendor/  
> plugins/file\_column”  
> However I am still getting this when I try to display an uploaded image:  
> undefined method `url\_for\_file\_column’ for #Entry:0x250a82c  
> Any ideas?

Well, I did it differently to you - didn’t move any specific tags /  
trunk /  
branches stuff, just moved the whole thing.

So:

dave@slynux $ pwd  
/path/to/my/rails/app/vendor/plugins/file\_column  
dave@slynux $ ls  
branches tags trunk  
dave@slynux $ cd tags/  
dave@slynux $ ls  
rel\_0-3 rel\_0-3-1

Does that help?

Admittedly, I somewhat ignored part of the instructions and the wiki,  
since I  
wasn’t quite sure the instructions exactly matched my setup / the  
current  
version of the plugin, so figured I’d try and do it myself, then see  
what  
broke. Perhaps I should consider myself lucky that it worked first  
time?

Does your app appear to be creating the images (inside public) when you  
add  
them? If it’s creating them but not downloading them, then I’m not  
sure,  
since that would mean the plugin was found OK (I think), but that  
something  
else is going wrong. If it’s not creating them, I guess that means the  
plugin totally didn’t work for you, so at least you know where to start  
looking for a fix.

Only other thing I can think of is to make sure you’re running the  
latest gem  
Rails version (or newer, I guess). Here’s my script/about for this app:

About your application’s environment  
Ruby version 1.8.2 (i686-linux)  
RubyGems version 0.8.11  
Rails version 1.0.0  
Active Record version 1.13.2  
Action Pack version 1.11.2  
Action Web Service version 1.0.0  
Action Mailer version 1.1.5  
Active Support version 1.2.5  
Application root /path/to/my/rails/app  
Environment development  
Database adapter mysql

Each time I upgrade, I’ve got in the habit of uninstalling the old  
versions of  
my gems, so I only have one version of each installed. I have no idea  
if  
this is necessary or even desirable, but it doesn’t seem to have done me  
any  
harm so far.

Also, apologies for all this /path/to/my/rails/app stuff, I just prefer  
not to  
mention client names in public archived emails, just to be on the safe  
side.

Cheers,

~Dave

–

Dave S.  
Rent-A-Monkey Website Development  
Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/5 "2006-01-21T15:40:34Z")

</div>

> Well, I did it differently to you - didn’t move any specific tags /  
> trunk /  
> branches stuff, just moved the whole thing.

When I tried that the plugin did not load at all.

> start  
> looking for a fix.

Yes they upload and are on the filesystem as well as in the DB. I can  
create and upload them just fine, even using RMajick to scale them.  
Trying to load them back is where I get the issues. I am thinking I  
might just be doing something stupid but I can’t figure it out. I put  
the model/view/controller code here - [http://rafb.net/paste/results/](http://rafb.net/paste/results/)  
2sSPa676.html if your feeling generous enough to look it over I would  
be forever indebted 🙂

> Active Record version 1.13.2  
> Action Pack version 1.11.2  
> Action Web Service version 1.0.0  
> Action Mailer version 1.1.5  
> Active Support version 1.2.5  
> Application root /path/to/my/rails/app  
> Environment development  
> Database adapter mysql

That all matches, thanks for checking.

> –
> 
> Dave S.  
> Rent-A-Monkey Website Development  
> Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

- Bill

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [January 21, 2006, 3:44pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/6 "2006-01-21T15:44:35Z")

</div>

On Monday 16 Jan 2006 20:16, Bill P. wrote:

> When I tried that the plugin did not load at all.

Fair enough. 🙂

> Yes they upload and are on the filesystem as well as in the DB. I can  
> create and upload them just fine, even using RMajick to scale them.  
> Trying to load them back is where I get the issues. I am thinking I  
> might just be doing something stupid but I can’t figure it out. I put  
> the model/view/controller code here - [http://rafb.net/paste/results/](http://rafb.net/paste/results/)  
> 2sSPa676.html if your feeling generous enough to look it over I would  
> be forever indebted 🙂

Instead of this in your view:

\<% for entry in @entries %\>  
\<%= entry.id %\>  
\<%= entry.url\_for\_file\_column %\>  
\<%= url\_for\_file\_column( entry, “image”) %\>  
\<% end %\>

… try something like this:

\<% for @entry in @entries %\>  
\<%= @entry.id %\>  
\<%= image\_tag url\_for\_file\_column “entry”, “image”, “medium” %\>  
\<% end %\>

You need the @ on @entry, and you also missed which of your two images  
you  
were using, so it could have been either of those, or both!?

See the bit on the Wiki page about using this with iterators - “just a  
note  
about using url\_for\_file\_column inside an iteration”:

[http://wiki.rubyonrails.com/rails/pages/HowToUseFileColumn](http://wiki.rubyonrails.com/rails/pages/HowToUseFileColumn)

Any luck? 🙂

~Dave

–

Dave S.  
Rent-A-Monkey Website Development  
Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [February 24, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/file-column-plugin-error/61811/7 "2006-02-24T18:45:51Z")

</div>

Woohoo!! Thanks Dave, I owe you big time. For some reason I never  
stumbled across that Wiki page ;-/

FYI if you don’t specify what image it uses the original non-scaled  
version from what I can tell.

On Jan 16, 2006, at 1:25 PM, Dave S. wrote:

> > 2sSPa676.html if your feeling generous enough to look it over I would  
> > … try something like this:  
> > See the bit on the Wiki page about using this with iterators -
> 
> Dave S.  
> Rent-A-Monkey Website Development  
> Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

- Bill
