Hi again..
I was tryiing to solve this but now I have this
class Project < ActiveRecord::Base
acts_as_taggable
acts_as_commentable
has_permalink :name, :update => true
has_many :images
named_scope :latest, lambda { |q| {:order => 'project_date DESC', :limit => q } }
admin_fieldset do |b|
b.text_field :name
b.text_field :client
b.date_select :project_date
b.text_area :description
b.text_area :supply
b.text_area :service
end
admin_child_table 'Images', :images do |b|
b.static_text :filename
end
admin_child_form 'images' do |f|
#f.select :project
f.file_field :uploaded_data
end
end
and my other model
class Image < ActiveRecord::Base
belongs_to :project
has_attachment :content_type => :image,
:storage => :file_system,
:partition => false,
:path_prefix => 'public/files',
:resize_to => '200x200>',
:thumbnails => { :thumb => '50x50>' },
:max_size => 3.megabyte
def label
filename
end
admin_fieldset do |b|
b.file_field :uploaded_data
b.select :project
end
end
I want to use the admin_child_form from project model but I get this message
TypeError in Auto_admin#edit
Showing vendor/plugins/auto_admin/themes/django/views/edit.html.erb where line #15 raised:
can't convert Fixnum into String
Extracted source (around line #15):
12: builder.prologue do
13: end
14: model.active_admin_fieldsets.each do |set|
15: set.build builder
16: end
17:
18: %>
Why? and your readme file say: WARNING:
This also has no tests, and I believe it will break horribly if you try to
use it at all.
PLease
Dennis C.
Some notes:
multipartflag;file_fieldhelper simply delegates to the standard one for maximum flexibility;To handle attachments/file uploads use whatever you feel at ease with (attachment_fu, paperclip, etc).
OK thanks..
First case:
I dont use any plugins I have:
Model.rb after_save :save_files def save_files
file_path = File.join("public", "files",image.original_filename)
File.open(file_path, "wb") { |f| f.write(image.read) }
end In this case auto_admin works very good.
Second case:
I use attachment_fu plugin with ajax to multiple uploads files and a model attachment.rb
attachment.rb
belongs_to :attachable, :polymorphic => true has_attachment :storage => :file_system,
and my Post.rb
has_many :attachments, :as => :attachable, :dependent => :destroy
and Post_controller after create or update call
def process_file_uploads
end
So.. in this case how do I set the admin admin_fieldset on my post model?... or use admin_child_table but I dont have limit files to upload. so I use ajax.
Please help me in this case
Dennis