I am getting a bizarre problem using attachment_fu and I was wondering if anyone knows how to fix it/ why its happening. Ive been following: http://clarkware.com/cgi/blosxom/2007/02/24 and I am up and running as far as upload etc goes, but when it comes to display using: <% for mugshot in @mugshots -%> <%= link_to image_tag(mugshot.public_filename(:thumb)), mugshot.public_filename %> <% end -%> I get two images, one is a thumbnail which links to the original file. That is what I want. html: <a href="/image_uploads/0000/0001/test.JPG"><img alt="Test_thumb" src="/image_uploads/0000/0001/test_thumb.JPG?1185027500" /></a> but the other is: <a href="/image_uploads/0000/0001/test_thumb.JPG"><img alt="Test_thumb_thumb" src="/image_uploads/0000/0001/ test_thumb_thumb.JPG" /></a> does anyone know where on earth the ''_thumb_thumb'' came from? and does anyone know how to solve this problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rails noob here,
I am having trouble getting a simple attachment_fu file upload form to
work. I am using Mike Clark''s tutorial on attachment_fu -
http://clarkware.com/cgi/blosxom/2007/02/24 . My code is the same as
the tutorial but with a few minor naming conditions that are different
and the form. I have RMagick installed and it''s dependencies as well
as the attachment_fu plugin. It''s not saving in the controller and I
am getting the message "there was a problem". I am not getting any
Rails or Ruby errors. Can anyone help......here is my code:
new.rhtml :
-----------------------------------
       <% if flash[:notice] -%>
	  <div id="notice"><%= flash[:notice] %></div>
	<% end -%>
	<% form_tag( {:action=>''create''}, :multipart=>true )
do -%>
	  <p>
	    <label for="lodge_photo">Upload A Photo:</label>
	    <%= file_field_tag(:uploaded_data) %>
	  </p>
	  <p>
	    <%= submit_tag ''Create'' %>
	  </p>
	<% end -%>
lodge_photo.rhtml :
-----------------------------------
class LodgePhoto < ActiveRecord::Base
  has_attachment :content_type => :image,
                   :storage => :file_system,
                   :max_size => 500.kilobytes,
                   :resize_to => ''320x200>'',
                   :thumbnails => { :thumb =>
''100x100>'' }
  validates_as_attachment
end
lodge_photos_controller.rb :
-----------------------------------
class LodgePhotosController < ApplicationController
  def new
  end
  def show
    @lodge_photos = LodgePhoto.find(:all)
  end
  def create
    @lodge_photo = LodgePhoto.new(params[:lodge_photo])
    if @lodge_photo.save
      flash[:notice] = ''Photo saved successfully!''
      render :action => "show"
    else
      flash[:notice] = ''There was a problem!''
      render :action => "new"
    end
  end
end
DB Migration:
-----------------------------------
class CreateLodgePhotos < ActiveRecord::Migration
  def self.up
      create_table :lodge_photos do |t|
        t.column :parent_id,  :integer
        t.column :content_type, :string
        t.column :filename, :string
        t.column :thumbnail, :string
        t.column :size, :integer
        t.column :width, :integer
        t.column :height, :integer
      end
    end
    def self.down
      drop_table :lodge_photos
    end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 7/22/07, Acroterra <acroterra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Rails noob here, > I am having trouble getting a simple attachment_fu file upload form to > work. I am using Mike Clark''s tutorial on attachment_fu - > http://clarkware.com/cgi/blosxom/2007/02/24 . My code is the same as > the tutorial but with a few minor naming conditions that are different > and the form. I have RMagick installed and it''s dependencies as well > as the attachment_fu plugin. It''s not saving in the controller and I > am getting the message "there was a problem". I am not getting any > Rails or Ruby errors. Can anyone help......here is my code:When an active record model doesn''t save it means: either a before_save callback returned false, or there were validation errors. You''re not showing any validation errors in the new.rhtml view: <%= error_messages_for :whatever %> Thomas Beck wrote up some issues with using this plugin on windows: http://www.beckshome.com/PermaLink,guid,8fc9bb84-3f9e-4d11-aa48-fa042b4806fd.aspx If anyone can suggest fixes, send them in as patches please. I don''t have a windows machine handy at the moment. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---