Forum: Ruby on Rails file_column problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ba734bc19e2a6321fb19e723dc427643?d=identicon&s=25 Ted Ster (tedster)
on 2006-02-16 18:53
I cannot get the file_column plugin to work.  Probably something stupid
I am doing wrong as I am pretty much a newbie...

1.	I added a varchar column to my table called "image"

2.	This is my class:

class User < ActiveRecord::Base

  file_column :image, :magick => { :geometry => "80x80>" }
  attr_accessor :new_password

... rest of class


3.	In my controller I have the following code:

  # loads up the form
  def yourpic
  	@user = User.new(session[:user])
  end

  # handles the form
  def updateyourpic
    @user = User.new(@params[:user])
    redirect_to :action => 'account', :id => @user
  end

4.	Form looks like this:

<%= form_tag({ :action => 'updateyourpic' , :id => @user },  :multipart
=> true)  %>
    <%= render_partial 'userpic', :user => @user, :submit => true %>
<%= end_form_tag %>

in my subform I have...

  <%= file_column_field "user", "image" %><br />
  <br />
  <%= submit_tag 'Upload it!' %>


5.	The file shows up in the temporary directory, but never gets saved to
the database or to the file system.

6.	I get the following errors in the console:

127.0.0.1 - - [16/Feb/2006:12:35:46 Eastern Standard Time] "GET
/user/yourpic HTTP/1.1" 200 1332
http://localhost:3000/user/account -> /user/yourpic
./script/../config/../app/helpers/user_helper.rb:7: warning: already
initialized constant DEFAULT_HEAD_OPTIONS
./script/../config/../vendor/plugins/trunk/lib/file_column.rb:193:
warning: already initialized constant EXT_REGEXPS
./script/../config/../vendor/plugins/trunk/lib/file_column.rb:587:
warning: already initialized constant MIME_EXTENSIONS
./script/../config/../vendor/plugins/trunk/lib/file_column.rb:590:
warning: already initialized constant EXTENSIONS
./script/../config/../vendor/plugins/trunk/lib/file_column.rb:605:
warning: already initialized constant DEFAULT_OPTIONS
-e: No such file or directory - file -bi
"./script/../config/../public/user/image/tmp/1140111351.668000.2496/BIO_Pic.jpg"
127.0.0.1 - - [16/Feb/2006:12:35:51 Eastern Standard Time] "POST
/user/updateyourpic/ HTTP/1.1" 302 101
http://localhost:3000/user/yourpic -> /user/updateyourpic/
[2006-02-16 12:35:52] ERROR Errno::EINVAL: Invalid argument
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:325:in `gets'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:325:in `__send__'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:325:in `_read_data'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:324:in `timeout'
	c:/ruby/lib/ruby/1.8/timeout.rb:55:in `timeout'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:324:in `_read_data'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:335:in `read_line'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:225:in `read_request_line'
	c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:86:in `parse'
	c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:56:in `run'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'
	c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'
	c:/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/webrick_server.rb:69:in
`dispatch'
	c:/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/servers/webrick.rb:59
	c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
	c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
	c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in
`require'
	c:/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/server.rb:28
	c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
	c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
	c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in
`require'
	./script/server:3
	-e:3:in `load'
	-e:3

Can anybody give me any advice on this?
Ba734bc19e2a6321fb19e723dc427643?d=identicon&s=25 Ted Ster (tedster)
on 2006-02-21 01:50
bump...
This topic is locked and can not be replied to.