File Column installation


#1

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


#2

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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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 >


#3

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 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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 >



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Hunter H. 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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 >



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#4

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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)
To: 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 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


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Hunter H. 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


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
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 >


#5

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 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)
To: 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 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Hunter H. 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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%20



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
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 >



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#6

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:infu_mkdir’
/usr/lib64/ruby/1.8/fileutils.rb:217:in mkpath' /usr/lib64/ruby/1.8/fileutils.rb:215:inmkpath’
/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:ininit_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:increate’

/usr/lib64/ruby/1.8/fileutils.rb:243:in mkdir' /usr/lib64/ruby/1.8/fileutils.rb:243:infu_mkdir’
/usr/lib64/ruby/1.8/fileutils.rb:217:in mkpath' /usr/lib64/ruby/1.8/fileutils.rb:215:inmkpath’
/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:ininit_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:inload’
#{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:independ_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:inconst_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:inperform_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:inmeasure’
/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:inperform_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:inprocess’
/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:infu_mkdir’
/usr/lib64/ruby/1.8/fileutils.rb:217:in mkpath' /usr/lib64/ruby/1.8/fileutils.rb:215:inmkpath’
/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:ininit_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 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 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)
To: 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 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Hunter H. 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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: 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%20



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
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 >



Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
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


#7

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
Reply-To: removed_email_address@domain.invalid
Date: Sat, 3 Dec 2005 17:27:04 -0800 (PST)
To: 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 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
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://lists.rubyonrails.org/mailman/listinfo/rails
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


Rails mailing list
removed_email_address@domain.invalid
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 >