im using the Photo model, which refers to the Uploader class.
class Photo < ActiveRecord::Base attr_accessible :title, :album_id belongs_to :album mount_uploader :photo_image, PhotosUploader end class Album < ActiveRecord::Base attr_accessible :title, :autor, :photos_attributes has_many :photos, :dependent => :destroy accepts_nested_attributes_for :photos end
but .. when I try to save a new album (or edit anything ..) with an image, it does not save the file (a copy of photo_image is saved as NULL, and the file is also not saved.
... views / albums / _form.html.erb
<%= f.fields_for :photos do |f| %> <div class="field"> <%= f.label :photo_image %><br /> <%= f.file_field :photo_image %> </div> <% end %>
any suggestion?
source share