Forum: Ruby on Rails file_column error

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.
E25296bf52723dc37bc462271eb02d2d?d=identicon&s=25 Jason Pfeifer (jpfeifer)
on 2006-05-12 02:20
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
E25296bf52723dc37bc462271eb02d2d?d=identicon&s=25 Jason Pfeifer (jpfeifer)
on 2006-05-12 02:38
Sorry, this is what it I am getting back from this code:

view:

<% @images.each do |@image| %>
     <p>Title: <%=h @image.name %></p>
     <%= 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
99c89698aa4661ec1750c0fb9b798eab?d=identicon&s=25 Nicholas P. Mueller (Guest)
on 2006-05-13 04:53
(Received via mailing list)
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
Ab14c50a93717a5bfd342496317975c4?d=identicon&s=25 Arie Kusuma Atmaja (Guest)
on 2006-05-13 06:24
(Received via mailing list)
> Jason Pfeifer wrote:
>> Sorry, this is what it I am getting back from this code:
>>
>> view:
>>
>> <% @images.each do |@image| %>
>>      <p>Title: <%=h @image.name %></p>
>>      <%= 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 Atmaja, 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????
This topic is locked and can not be replied to.