File_column error


#1

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


#2

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:ininitialize’
#{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:infile_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:inurl_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


#3

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


#4

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
Ruby : http://groups.yahoo.com/groups/id-ruby
!Ruby : 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???