Getting nil errors on file_column after update


#1

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:inabsolute_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,

);


#2

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 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,

);


#3

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:


#4

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 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