# File\_column error

**URL:** <https://www.ruby-forum.com/t/file-column-error/94721>\
**Category:** Rails\
**Created:** [May 12, 2006, 2:20am UTC](https://www.ruby-forum.com/t/file-column-error/94721 "2006-05-12T02:20:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [May 12, 2006, 2:20am UTC](https://www.ruby-forum.com/t/file-column-error/94721/1 "2006-05-12T02:20:29Z")

</div>

Hmm, I’m using file\_column and going by this tutorial, the files upload  
ok and I can see the fields updated in the database, but I am getting  
this error:

“Trying to access file\_column, but primary key got lost.”

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [May 12, 2006, 2:38am UTC](https://www.ruby-forum.com/t/file-column-error/94721/2 "2006-05-12T02:38:14Z")

</div>

Sorry, this is what it I am getting back from this code:

view:

\<% @images.each do |@image| %\>

Title: \<%=h @image.name %\>

  
\<%= image\_tag url\_for\_file\_column(‘image’,‘file’) %\>  
\<% end %\>

controller:

def list\_images  
@images = Image.find(:all)  
end

#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:398:in  
`relative_path_prefix' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:349:in`initialize’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:16:in  
`create_state' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:628:in`file\_state’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:641:in  
`file_relative_path' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column_helper.rb:75:in`url\_for\_file\_column’  
#{RAILS\_ROOT}/app/views/admin/list\_images.rhtml:3:in  
`_run_rhtml_admin_list_images' #{RAILS_ROOT}/app/views/admin/list_images.rhtml:1:in`\_run\_rhtml\_admin\_list\_images’  
-e:3

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [May 13, 2006, 4:53am UTC](https://www.ruby-forum.com/t/file-column-error/94721/3 "2006-05-13T04:53:31Z")

</div>

I don’t have code in front of me, but I think the problem is in your  
url\_for\_file\_column

I think it should be:

url\_for\_file\_column(@image,‘file’)

instead. Right now you are just passing url\_for\_file\_column a string  
with contents ‘image’, not the @image object (with the attendant id).

Nicholas P. Mueller

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [May 13, 2006, 6:24am UTC](https://www.ruby-forum.com/t/file-column-error/94721/4 "2006-05-13T06:24:32Z")

</div>

> Jason P. wrote:
> 
> > Sorry, this is what it I am getting back from this code:
> > 
> > view:
> > 
> > \<% @images.each do |@image| %\>
> > 
> > Title: \<%=h @image.name %\>
> > 
> >   
> > \<%= image\_tag url\_for\_file\_column(‘image’,‘file’) %\>  
> > \<% end %\>

\<% for image in @images do -%\>  
\<%= image\_tag url\_for\_file\_column(‘image’, ‘file’) %\>  
\<% end -%\>

> > controller:
> > 
> > def list\_images  
> > @images = Image.find(:all)  
> > end

–  
Name : Arie Kusuma A., A.K.A Arie, A.K.A ariekeren / YM! = riyari3  
Blog : [http://ariekusumaatmaja.wordpress.com](http://ariekusumaatmaja.wordpress.com)  
Ruby : [Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos](http://groups.yahoo.com/groups/id-ruby)  
!Ruby : [IndoForums.com is for sale | HugeDomains](http://indoforums.com/englishklab)

500 lines in PHP dkk VS 1 line in Ruby dkk  
300 baris di Java dkk VS 1 baris di Ruby dkk  
Macih ngotot pake (as|ph)p? haree geneee???
