Lee Smith wrote:
> Since you're new to RoR, why not use a plugin like Paperclip?  It does
> exactly what you're trying to do and much more...should save you a lot
> of time.
> 
> http://www.thoughtbot.com/projects/paperclip
> 
> http://railscasts.com/episodes/134-paperclip

Thanks for your answer.

Ok now I have a problem with paperclip. Is it possible that it doesn't 
work under windows vista? I installed the plugin and tried the example 
from the paperclip page. There are entries in the db but with null 
values in the image related columns and the pictures are not in the 
puplic directory.

I'm getting crazy!

Here is what I've done:

challenge.rb

class Challenge < ActiveRecord::Base
  belongs_to :user
  has_attached_file :thumbnail, :styles => {:thumb => '100x100>'}


end

new.html.erb

<h1>Post new Challenge</h1>
    <%form_tag :action => 'create', :multipart => true do %>
      <p>Challenge Title: </p>
      <%= text_field 'challenge', 'title'%> <br/>
      <p>Description: </p>
      <%= text_field 'challenge', 'description'%><br/>
      <p>Challenge Thumbnail: </p>
      <%= file_field 'challenge', :thumbnail%>
      <%= submit_tag 'Create' %>
    <%end%>

challenges_controller.rb

 def create
    @challenge = Challenge.create params[:challenge]

    if !...@challenge.valid?
      flash.now[:error] = 'Bitte füllen sie alle Felder aus!'
      render :action => :new
   else if !...@challenge.save
        flash.now[:error] = 'Es trat ein Fehler beim speichern auf!'
        render :action => :new
      else
        redirect_to :action => 'list'
      end
    end

  end
-- 
Posted via http://www.ruby-forum.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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to