Displaying 3 results from an estimated 3 matches for "asset_fields".
2011 Oct 05
2
formtastic / activeadmin
Newbie question:
want to following code to migrate to formtastic:
<% f.fields_for :assets do |asset_fields| %>
<% if asset_fields.object.new_record? %>
<p>
<%= asset_fields.file_field :asset %>
</p>
<% end %>
<% end %>
tried this:
f.inputs "Appartment Details" do
f.input :assets do |asset_fields|
asset_fields.file_field.input :asset,...
2006 Feb 05
0
validating presence of file uploads
not sure whats going on here, but I''m using some pretty standard code to
manage file uploads in to a db, but having trouble detecting if the file
upload field has been filled or not.
in my Asset Model, I have:
def asset=(asset_field)
self.name = base_part_of(asset_field.original_filename)
self.content_type = asset_field.content_type.chomp
self.data = asset_field.read
end
def
2009 Aug 07
2
paperclip model fails while when updating with no attachment
...}
asset.attachment = attributes_hash[:attachment] # adds the
attributes to the asset
asset.save! # saves the asset
end
end
[/code]
my view model looks like this:
[code]
<%- for asset in @item.assets do -%>
<% f.fields_for("asset_attributes[]", asset) do |asset_fields| %>
<p>
<%= asset_fields.label :attachment, "File" %><br />
<%= asset_fields.file_field :attachment, :index => nil %><br />
<%= asset_fields.hidden_field :id, :index => nil unless(
asset.new_record? ) %>
</p>
&...