Teraz podam inny kod może to pomoże:
Widok metody new dla articlews_controller:
[code]<%= debug current_user %>
<% semantic_form_for(@article, :html => {:multipart => true}) do |f| %>
<% f.inputs :name => "Treść i kategoria artykułu" do %>
<%= f.input :title, :label => "Tytuł" %>
<%= f.label(:wstęp_do_artykułu, :synopsis, :required => true) %>
<%= f.tinymce_managed :synopsis, :width => '600px', :height => '200px' %>
<%= f.label(:treść_artykułu, :body, :required => true) %>
<%= f.tinymce_managed :body, :width => '600px', :height => '400px' %>
<%= f.input :published, :label => "Publikować?", :as => :radio %>
<%= f.input :categories, :label => "Kategoria", :as => :check_boxes, :collection => nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" }, :for => :categories %>
<% end %>
<% f.inputs :name => "Autorzy i Fotografowie Artykułów" do %>
<%= f.input :authors, :label => "Autorzy", :as => :check_boxes, :collection => Author.find(:all) %>
<%= f.input :photographers, :label => "Fotografowie", :as => :check_boxes, :collection => Photographer.find(:all) %>
<% end %>
<%# f.inputs :name => 'Zdjęcia do Artykułu', :id => 'photos' do %>
<%#= f.render_associated_form :photos, :partial => 'articles/photo', :f => f %>
<%#= f.add_associated_link "+", :photos, :partial => 'articles/photo', :f => f %>
<%# end %>
<%= f.render_associated_form(@article.photos, :new => 2) %>
<%= f.add_associated_link('Add another photo', @article.photos.build) %>
<% f.buttons do %>
<%= f.commit_button :label => "Zapisz" %>
<% end %>
<% end %>
[/code]
partial _photo:
[code]<%#%>
<%#= f.input :description %>
<%#= f.input :file, :as => :file %>
<%#= f.remove_link “Usuń” %>
<%#
%>
Description:
<%= f.text_field :description %>
Photo:
<%= f.file_field :file %>
<%= f.remove_link “remove” %>
[/code]
Korzystam z tutoriala na stronie: [url=http://www.mfischer.com/wordpress/2009/02/02/multiple-image-upload-and-crop-with-rails/]Multiple image upload and crop with Rails[/url]
W widoku oraz partialu są zakomentowane pewne części formularza które niestety nie działają wątek juz uruchomilem wczoraj na forum: formtastic i attribute_fu problem