Roman Sladeczek wrote:
> Hallo Knut,
> schau Dir attachment_fu an. Ist vielleicht overkill f�r Deinen
> jetzigen Bedarf, aber Du wirst in Zukunft vielleicht �fter Bilder
> verarbeiten wollen. Hier lohnt sich eine Einarbeitung auf alle F�lle.
> Gruss,
> Roman
> 
> Am 20.09.2008 um 10:28 schrieb Knut Linke:

Hallo Roman, Andreas und Werner,
danke fuer eure Antworten :). Ich habe mir Attachment_FU angesehen und 
das Tutorial von 
http://clarkware.com/cgi/blosxom/2007/02/24#FileUploadFu angesehen.

Leider bekomme ich die Fehlermeldung:
There were problems with the following fields:

Size is not included in the list

Wenn ich einen Upload durchfuehre. Die Size ist im Model definiert mit:
class Mugshot < ActiveRecord::Base

  has_attachment :content_type => :image,
                 :storage => :file_system,
                 :max_size => 5000.kilobytes


  validates_as_attachment

end

Was kann die Fehlermeldung "not included in the list" noch bedeuten?

Im View oder im Controller frage ich die Groesse nicht ab:
View:
<% form_for(:mugshot, :url => { :action => "create", },
                      :html => { :multipart => true }) do |f| -%>
  <p>
    <label for="mugshot">Upload A Mugshot:</label>
    <%= f.file_field :uploaded_data %>
  </p>
  <p>
    <%= submit_tag 'Create' %>
  </p>
<% end -%>

Controller:
class MugshotController < ApplicationController
def new
  @mugshot = Mugshot.new
end

def create
  @mugshot = Mugshot.new(params[:mugshot])
  if @mugshot.save
    flash[:notice] = 'Mugshot was successfully created.'
    redirect_to mugshot_url(@mugshot)
  else
    render :action => :new
  end
end

end
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an