# File\_column error

**URL:** <https://www.ruby-forum.com/t/file-column-error/52551>\
**Category:** Rails\
**Created:** [January 16, 2006, 8:34am UTC](https://www.ruby-forum.com/t/file-column-error/52551 "2006-01-16T08:34:46Z")\
**Posts on this page:** 4\
**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, 8:34am UTC](https://www.ruby-forum.com/t/file-column-error/52551/1 "2006-01-16T08:34:46Z")

</div>

Hi, Sebastian

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 19, 2006, 2:50pm UTC](https://www.ruby-forum.com/t/file-column-error/52551/2 "2006-01-19T14:50:14Z")

</div>

On Jan 16, 2006, at 12:34 AM, Tom S. wrote:

> My environement is Red Hat linux 9.0 with mysql 4.1. I installed  
> find “file\_column” plugin.  
> end  
> redirect\_to :action =\> ‘list’
> 
> # The work is completed in #create.
> 
> def new  
> @entry = Entry.new  
> end
> 
> end
> 
> Error:

Tom,

A couple of things to check, just off hand. First, did you restart  
your webserver? Plugins are loaded once, during initialization, and  
not for every page load. Second, is there an init.rb file directly  
inside the vendor/plugins/file\_column/ directory? If so, can you add  
some debug output such as "RAILS\_DEFAULT\_LOGGER.error ‘inside  
init.rb’ " and see the output in your log files (this would confirm  
that init.rb is being seen by the initializer)? And you’re running  
Rails 1.0?

Duane J.  
(canadaduane)

---

<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 19, 2006, 4:45pm UTC](https://www.ruby-forum.com/t/file-column-error/52551/3 "2006-01-19T16:45:02Z")

</div>

Tom S. wrote:

> Hi, Sebastian
> 
> 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.

Does your “entries” database table contain a varchar field called  
“image”? That’s a necessary piece of using file\_column that isn’t  
well-documented.

To clarify, for a file\_column field called “image” you need

1. the plugin installed (which it looks like you’ve done, but  
double-check its permissions to make sure it’s readable to your  
webserver)

2. a varchar/string field in your table for each class attribute you  
want to use with file\_column, in your case named “image” (which gets  
filled automagically with the filename) and

3. the declaration in the model (file\_column :image) (which you’ve done  
right).

-sk

---

<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 20, 2006, 10:38am UTC](https://www.ruby-forum.com/t/file-column-error/52551/4 "2006-01-20T10:38:30Z")

</div>

Hi Tom,

On 1/16/06, Tom S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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

hmm, that’s one directory too many. Please delete both directories and  
make sure that everything from “trunk” lives in a “file\_column”  
directory in “vendor/plugins”, restart your web-server and try again.

After deleting all old file\_column directories, you should be able to  
install the files from “trunk” via the following command:

./script/plugin install   
[http://opensvn.csie.org/rails\_file\_column/plugins/file\_column/trunk](http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk)

Hope this helps  
Sebastian
