# Getting nil errors on file\_column after update

**URL:** <https://www.ruby-forum.com/t/getting-nil-errors-on-file-column-after-update/49598>\
**Category:** Rails\
**Created:** [November 22, 2005, 9:56pm UTC](https://www.ruby-forum.com/t/getting-nil-errors-on-file-column-after-update/49598 "2005-11-22T21:56:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 22, 2005, 9:56pm UTC](https://www.ruby-forum.com/t/getting-nil-errors-on-file-column-after-update/49598/1 "2005-11-22T21:56:21Z")

</div>

I have file\_column setup as a svn:external, so I’m basically always  
running  
the latest version. There was a recent update to file\_column and after  
the  
update, my application breaks. here is the error message, any ideas?

can’t convert nil into String

./script/…/config/…/vendor/plugins/file\_column/lib/file\_column.rb:144:in  
`join' ./script/../config/../vendor/plugins/file_column/lib/file_column.rb:144:in`absolute\_path’  
./script/…/config/…/vendor/plugins/file\_column/lib/file\_column.rb:558:in  
`image' #{RAILS_ROOT}/app/views/user/_edit.rhtml:1:in`\_run\_rhtml\_user\_\_edit’  
#{RAILS\_ROOT}/app/views/user/edit.rhtml:8:in `\_run\_rhtml\_user\_edit’

This is happening when I try to upload a file. I haven’t changed  
anything in  
my model, view or controller. Here are the relevant code snippets:

Model (Profile):

file\_column :image, :magick =\> { :geometry =\> ‘500\>’, :versions =\> {  
‘small’ =\> ‘50\>’, ‘medium’ =\> ‘200\>’ } }

Controller (User)

# I do have an instance of my profile object in my view

@profile = @user.profiles.find\_first

View (edit)

\<% if not @profile.image.nil? %\> \<-- this is the line throwing the  
exception

 \<%= image\_tag url\_for\_file\_column('profile', 'image', 'small') %\> \<% end %\>

\<%= file\_column\_field ‘profile’, ‘image’ %\>

Profile Table

CREATE TABLE profiles (  
…  
image VARCHAR(50) default NULL,  
…  
);

---

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 25, 2005, 8:41pm UTC](https://www.ruby-forum.com/t/getting-nil-errors-on-file-column-after-update/49598/2 "2005-11-25T20:41:39Z")

</div>

Just bumping this up cause I never got a reply and still getting  
error. Any help would be greatly appreciated.

On 11/22/05, Ramin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ‘small’ =\> ‘50\>’, ‘medium’ =\> ‘200\>’ } }  
> \<% if not @profile.image.nil? %\> ← this is the line throwing the
> 
> Profile Table  
> CREATE TABLE profiles (  
> …  
> image VARCHAR(50) default NULL,  
> …  
> );

–

- Ramin  
[http://www.getintothis.com/blog](http://www.getintothis.com/blog)

---

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 25, 2005, 10:14pm UTC](https://www.ruby-forum.com/t/getting-nil-errors-on-file-column-after-update/49598/3 "2005-11-25T22:14:20Z")

</div>

my 2 cents would be to try using

\<%= image\_tag url\_for\_file\_column(‘profile’, ‘image’, ‘small’) if  
@profile.image %\>

2005/11/25, Ramin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 25, 2005, 11:19pm UTC](https://www.ruby-forum.com/t/getting-nil-errors-on-file-column-after-update/49598/4 "2005-11-25T23:19:05Z")

</div>

Well, I would use that logic, but i have more HTML tags that I don’t  
want to show if the image is NIL. I think the logic is pretty much the  
same and isn’t the source of the real problem. I looked at the  
file\_column code and it seems like its trying to “join” some strings  
with a nil object (line 144 in file\_column.rb - the variable subdir is  
defaulted to nil)

When I change the code and set the default value of subdir to an empty  
string as opposed to nil, I no longer get that error. However, since  
the code was changed to use subdirectories instead of  
imagefile\_version.ext, my images are not being copied or moved over to  
the proper subdirectories (“medium” and “small”, in my case.)

Another weird thing is that subdirectories are actually being created,  
but their names are totally random strings and numbers. Its as if the  
code was creating the directories not based off of the versions I  
specify, but based on the hash value of the object id or something.  
Not too familiar with Ruby and object names/ids, but thats just my  
guess.

On 11/25/05, Oliver B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > `image’  
> > > file\_column :image, :magick =\> { :geometry =\> ‘500\>’, :versions =\> {  
> > > View (edit)
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

- Ramin  
[http://www.getintothis.com/blog](http://www.getintothis.com/blog)
