# File Column installation

**URL:** <https://www.ruby-forum.com/t/file-column-installation/49407>\
**Category:** Rails\
**Created:** [December 3, 2005, 8:52pm UTC](https://www.ruby-forum.com/t/file-column-installation/49407 "2005-12-03T20:52:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 3, 2005, 8:52pm UTC](https://www.ruby-forum.com/t/file-column-installation/49407/1 "2005-12-03T20:52:25Z")

</div>

I’ve installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

---

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 3, 2005, 11:44pm UTC](https://www.ruby-forum.com/t/file-column-installation/49407/2 "2005-12-03T23:44:22Z")

</div>

What action does the form submit to?

You need an action that creates an instance, populates it from the form  
and  
then saves it. Maybe you have one already and didnÂ¹t include it here?

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’ve installed File-column – placed into vendor plugins directory,  
added  
the model, added a controller, and created a view with submit form.  
Yet,  
when I view the page, everything looks correct, but when submitting the  
file, nothing is actually stored in the database – and there are no  
errors  
reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>

---

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 4, 2005, 2:06am UTC](https://www.ruby-forum.com/t/file-column-installation/49407/3 "2005-12-04T02:06:27Z")

</div>

You’re right, the action is missing. I thought between the view, the  
model, and the plugin, the neceesary ops would have been taken care of.  
Would would be a suitable action?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:Re: [Rails] File Column  
installation What action does the form submit to?

You need an action that creates an instance, populates it from the form  
and then saves it. Maybe you have one already and didnÂ?t include it  
here?

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’ve installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:Re: [Rails] File Column  
installation What action does the form submit to?

You need an action that creates an instance, populates it from the form  
and then saves it. Maybe you have one already and didnÂ?t include it  
here?

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’ve installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 4, 2005, 2:18am UTC](https://www.ruby-forum.com/t/file-column-installation/49407/4 "2005-12-04T02:18:36Z")

</div>

File column simply makes dealing with files easier. If you want to do  
database access of any kind with ActiveRecord, you still need to save  
the  
object.

```
def create
    @instance = MyModel.new(params[:instance_form_name])
    if @ instance .save
        redirect_to :action => 'index'
    else
        #error occurred
        render :action => 'index'
    end
end

```

Or something like that.

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Rails] File Column installation

You’re right, the action is missing. I thought between the view, the  
model,  
and the plugin, the neceesary ops would have been taken care of. Would  
would be a suitable action?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
> Sample upload view follows:  
> Controller:
> 
> [http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
> Sample upload view follows:  
> Controller:
> 
> [http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com%20](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com%20)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>

---

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 4, 2005, 2:30am UTC](https://www.ruby-forum.com/t/file-column-installation/49407/5 "2005-12-04T02:30:44Z")

</div>

So taking the filecolumn example of model Entry, with filecolumn image,  
the second line in your example would be:  
@entry = Entry.new(params[:entry])  
?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:Re: [Rails] File Column  
installation File column simply makes dealing with files easier. If  
you want to do database access of any kind with ActiveRecord, you still  
need to save the object.

```
 def create
     @instance = MyModel.new(params[:instance_form_name])
     if @ instance .save
         redirect_to :action => 'index'
     else
         #error occurred
         render :action => 'index'
     end
 end

```

Or something like that.

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Rails] File Column installation

You’re right, the action is missing. I thought between the view, the  
model, and the plugin, the neceesary ops would have been taken care of.  
Would would be a suitable action?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Re: [Rails] File Column installation What action does the form  
submit to?

You need an action that creates an instance, populates it from the  
form and then saves it. Maybe you have one already and didnÂ?t include it  
here?

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’ve installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>  
[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com)

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Re: [Rails] File Column installation What action does the form  
submit to?

You need an action that creates an instance, populates it from the form  
and then saves it. Maybe you have one already and didnÂ?t include it  
here?

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’ve installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment ,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>  
[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com%20](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com%20)

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 4, 2005, 3:23am UTC](https://www.ruby-forum.com/t/file-column-installation/49407/6 "2005-12-04T03:23:29Z")

</div>

Using the code below, I get the following error:  
Errno::EEXIST in Entry#create  
File exists - /var  
RAILS\_ROOT: /var/www/html/app/public/…/config/…  
Application Trace | Framework Trace |  
Full Trace  
/usr/lib64/ruby/1.8/fileutils.rb:243:in `mkdir' /usr/lib64/ruby/1.8/fileutils.rb:243:in `fu\_mkdir’  
/usr/lib64/ruby/1.8/fileutils.rb:217:in `mkpath' /usr/lib64/ruby/1.8/fileutils.rb:215:in `mkpath’  
/usr/lib64/ruby/1.8/fileutils.rb:201:in `mkpath' #{RAILS_ROOT}/vendor/plugins/rails_file_column/plugins/file_column/trunk/lib/file_column.rb:25:in `init\_options’  
#{RAILS\_ROOT}/vendor/plugins/rails\_file\_column/plugins/file\_column/trunk/lib/file\_column.rb:539:in  
`file_column' #{RAILS_ROOT}/app/models/entry.rb:2 #{RAILS_ROOT}/app/controllers/entry_controller.rb:8:in `create’

/usr/lib64/ruby/1.8/fileutils.rb:243:in `mkdir' /usr/lib64/ruby/1.8/fileutils.rb:243:in `fu\_mkdir’  
/usr/lib64/ruby/1.8/fileutils.rb:217:in `mkpath' /usr/lib64/ruby/1.8/fileutils.rb:215:in `mkpath’  
/usr/lib64/ruby/1.8/fileutils.rb:201:in `mkpath' #{RAILS_ROOT}/vendor/plugins/rails_file_column/plugins/file_column/trunk/lib/file_column.rb:25:in `init\_options’  
#{RAILS\_ROOT}/vendor/plugins/rails\_file\_column/plugins/file\_column/trunk/lib/file\_column.rb:539:in  
`file_column' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:207:in `load’  
#{RAILS\_ROOT}/vendor/plugins/engines/lib/dependencies\_extensions.rb:45:in  
`require_or_load' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:22:in `depend\_on’  
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active\_support/dependencies.rb:178:in  
`require_dependency' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:194:in `const\_missing’  
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action\_controller/base.rb:841:in  
`perform_action_without_filters' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/filters.rb:332:in `perform\_action\_without\_benchmark’  
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/lib64/ruby/1.8/benchmark.rb:293:in `measure’  
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/rescue.rb:82:in `perform\_action’  
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action\_controller/base.rb:365:in  
`process_without_session_management_support' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/session_management.rb:116:in `process’  
/usr/lib64/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:38:in  
`dispatch’  
/var/www/html/bokidoki/public/dispatch.cgi:10

/usr/lib64/ruby/1.8/fileutils.rb:243:in `mkdir' /usr/lib64/ruby/1.8/fileutils.rb:243:in `fu\_mkdir’  
/usr/lib64/ruby/1.8/fileutils.rb:217:in `mkpath' /usr/lib64/ruby/1.8/fileutils.rb:215:in `mkpath’  
/usr/lib64/ruby/1.8/fileutils.rb:201:in `mkpath' #{RAILS_ROOT}/vendor/plugins/rails_file_column/plugins/file_column/trunk/lib/file_column.rb:25:in `init\_options’  
#{RAILS\_ROOT}/vendor/plugins/rails\_file\_column/plugins/file\_column/trunk/lib/file\_column.rb:539:in  
`file\_column’  
#{RAILS\_ROOT}/app/models/entry.rb:2

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

Any ideas?

Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote: So taking the filecolumn  
example of model Entry, with filecolumn image, the second line in your  
example would be:  
@entry = Entry.new(params[:entry])  
?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:Re: [Rails] File Column  
installation File column simply makes dealing with files easier. If  
you want to do database access of any kind with ActiveRecord, you still  
need to save the object.

```
 def create
     @instance = MyModel.new(params[:instance_form_name])
     if @ instance .save
         redirect_to :action => 'index'
     else
         #error occurred
         render :action => 'index'
     end
 end

```

Or something like that.

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Rails] File Column installation

You’re right, the action is missing. I thought between the view, the  
model, and the plugin, the neceesary ops would have been taken care of.  
Would would be a suitable action?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Re: [Rails] File Column installation What action does the form  
submit to?

You need an action that creates an instance, populates it from the  
form and then saves it. Maybe you have one already and didnÂ?t include it  
here?

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’v e installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> true}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>  
[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com)

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Re: [Rails] File Column installation What action does the form  
submit to?

You need an action that creates an instance, populates it from the  
form and then saves it. Maybe you have one already and didnÂ?t include it  
here?

* * *

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Rails] File Column installation

I’ve installed File-column – placed into vendor plugins directory,  
added the model, added a controller, and created a view with submit  
form. Yet, when I view the page, everything looks correct, but when  
submitting the file, nothing is actually stored in the database – and  
there are no errors reported.

Am I missing something?

Sample upload view follows:  
\<%= form\_tag({}, { :multipart =\> tr ue}) %\>  
\<%= file\_column\_field “entry”, “image” %\>  
\<%= submit\_tag ‘Upload’ %\>  
\<%= end\_form\_tag %\>

Model:  
class Entry \< ActiveRecord::Base  
file\_column :image  
end

Controller:  
class EntryController \< ApplicationController  
end

Database:  
CREATE TABLE entries (  
id int(11) NOT NULL auto\_increment ,  
image varchar(200) default NULL,  
file varchar(200) NOT NULL,  
PRIMARY KEY (id)  
)

Thanks  
-W

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>  
[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com%20](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com%20)

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Yahoo! Personals  
Let fate take it’s course directly to your email.  
See who’s waiting for you Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com) \>

* * *

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Yahoo! Personals  
Single? There’s someone we’d like you to meet.  
Lots of someones, actually. Yahoo!  
Personals\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![wborgon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ce7236/32.png) [@wborgon](https://www.ruby-forum.com/u/wborgon)\
**Post date:** [December 4, 2005, 2:47am UTC](https://www.ruby-forum.com/t/file-column-installation/49407/7 "2005-12-04T02:47:00Z")

</div>

Looking at the example, that seems to be correct.

If this stuff isnÂ¹t familiar to you I would suggest going through one of  
the  
many Rails tutorials out there Â­ this stuff should be covered in just  
about  
any basic tutorial.

From: Wolfgang B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sat, 3 Dec 2005 17:27:04 -0800 (PST)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Rails] File Column installation

So taking the filecolumn example of model Entry, with filecolumn image,  
the  
second line in your example would be:  
@entry = Entry.new(params[:entry])  
?

Hunter H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> render :action => 'index'
> 
> ```
> 
> Subject: Re: [Rails] File Column installation
> 
> > You need an action that creates an instance, populates it from the form and  
> > Subject: [Rails] File Column installation  
> > \<%= form\_tag({}, { :multipart =\> true}) %\>  
> > class EntryController \< ApplicationController  
> > Thanks  
> > [http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com%20](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com%20)  
> > removed\_email\_address@domain.invalid  
> > then saves it. Maybe you have one already and didnÂ¹t include it here?
> > 
> > \<%= file\_column\_field “entry”, “image” %\>  
> > end  
> > -W  
> > [http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com%20](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com%20)  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)  
> > [http://us.rd.yahoo.com/evt=36106/\*http://personals.yahoo.com%20](http://us.rd.yahoo.com/evt=36106/*http://personals.yahoo.com%20)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Yahoo! Personals  
Single? There’s someone we’d like you to meet.  
Lots of someones, actually. Yahoo! Personals  
\<[http://us.rd.yahoo.com/evt=36108/\*http://personals.yahoo.com](http://us.rd.yahoo.com/evt=36108/*http://personals.yahoo.com) \>
