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. [email protected] 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. [email protected] 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. [email protected]
Reply-To: [email protected]
Date: Sat, 3 Dec 2005 17:03:56 -0800 (PST)
To: [email protected]
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. [email protected] 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. [email protected]
Reply-To: [email protected]
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: [email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Hunter H. [email protected] 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. [email protected]
Reply-To: [email protected]
Date: Sat, 3 Dec 2005 11:52:04 -0800 (PST)
To: [email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Rails mailing list
[email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Rails mailing list
[email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails