Witam,
mam modele Article oraz Photo w modelu Article chciałbym zamieścic kilka zdjęć, uzywam paperclipa, formtastic ora attribute fu:
model Article
has_many :photos,
:attributes => true,
:discard_if => proc { |photo| photo.file_file_size.nil? }
model Photo
belongs_to :article
has_attached_file :file,
:styles => {
:thumb => ["100x100#", :jpg],
:pagesize => ["500x400", :jpg],
},
:default_style => :pagesize
Widok new.rhtml:
[code]
[/code]
<% semantic_form_for(@article, :html => {:multipart => true}) do |f| %><% f.inputs :name => 'Zdjęcia do Artykułu', :id => 'photos' do %> <%= f.render_associated_form :photos, :partial => 'articles/photo' %> <%= f.add_associated_link "+", :photos, :partial => 'articles/photo' %> <% end %> <% f.buttons do %> <%= f.commit_button :label => "Zapisz" %> <% end %>
Partial photo:
[code]
<%= f.input :description %>
<%= f.input :file, :as => :file %>
<%= f.remove_link “Usuń” %>
Showing app/views/articles/_photo.erb where line #2 raised:
undefined method `input’ for #ActionView::Helpers::FormBuilder:0xb6e158c8
Extracted source (around line #2):
1:
2: <%= f.input :description %>
3: <%= f.input :file, :as => :file %>
4: <%= f.remove_link “Usuń” %>
5:
nie wiem co robie źle i gdzie jest tak naprawdę przyczyna