You can check it out at the following URL:
http://activescaffold.googlecode.com/svn/branches/upload
it includes a copy of Sean Treadway's response_to_parent.
at the time being, here is the way to enable file uploads, for both
create and also update. for this example, you will need the
file_column plug-in to facilitate your uploads.
::app/controllers/entries_controller.rb::
class EntriesController < ApplicationController
active_scaffold :entry do |config|
config.create.multipart = true
config.update.multipart = true
end
end
::app/views/entries/_form.rhtml::
<% fields_for :record do |f| %>
<%= f.text_field :name %>
<%= f.text_field :age %>
<%= file_column_field 'record', :file %>
<% end %>
::app/views/entries/_show.rhtml::
<ul>
<li><%= @record.name %></li>
<li><%= @record.age %></li>
<li><%= link_to 'url', url_for_file_column(@record, 'file') %></li>
</ul>
please post your issues to this list and not to the Google issue
tracker for the time being. We are planning to merge this into core
for 1.1.
Thanks, and enjoy!
Tim
- Sai
On May 4, 11:58 am, jb <jbden...@gmail.com> wrote:
> Nice !
>
> On May 4, 5:41 pm, timcharper <timchar...@gmail.com> wrote:
>
> > I have been working on an active scaffold branch for some time that
> > supportsfileuploads via posting through an I-frame (Ajax stylefile
> > uploads). It is working very well for me, and I am using it in many
> > projects. I will maintain this branch and keep it up-to-date every
> > time active scaffold has a release. the current branch is merged
> > against active scaffold rc2.
>
> > You can check it out at the following URL:http://activescaffold.googlecode.com/svn/branches/upload
>
> > it includes a copy of Sean Treadway's response_to_parent.
>
> > at the time being, here is the way to enablefileuploads, for both
- Sai
On May 4, 11:58 am, jb <jbden...@gmail.com> wrote:
> Nice !
>
> On May 4, 5:41 pm, timcharper <timchar...@gmail.com> wrote:
>
> > I have been working on an active scaffold branch for some time that
> > supportsfileuploads via posting through an I-frame (Ajax stylefile
> > uploads). It is working very well for me, and I am using it in many
> > projects. I will maintain this branch and keep it up-to-date every
> > time active scaffold has a release. the current branch is merged
> > against active scaffold rc2.
>
> > You can check it out at the following URL:http://activescaffold.googlecode.com/svn/branches/upload
>
> > it includes a copy of Sean Treadway's response_to_parent.
>
> > at the time being, here is the way to enablefileuploads, for both
Script/plugin install
http://activescaffold.googlecode.com/svn/branches/upload
(you'll probably want to rename the folder vendor/plugins/upload to
vendor/plugins/active_scaffold_upload or something)
Tim
http://pastie.caboo.se/private/fo6qug8lsjaqlpufur
Haven't tried it yet, will give you feedback when I do.
- Sai
if someone try the example from the top ..
dont forget to set the file column, otherwise it was not working for
me .. (server error 500)
e.g
class Article < ActiveRecord::Base
file_column :file <<<<<<<<<<<<<<<<<<<<<<
has_and_belongs_to_many :user
has_and_belongs_to_many :usergroup
has_one :frame
has_and_belongs_to_many :articlegroup
end
regards
Philipp
E.g. project has_many documents
document has a file_column :file plus other metadata (eg summary)...
Requires a subform override.
- Sai
Thanks for the upload branch, nice job.
I wanted to take it for a spin but noticed it hasn't been merged with
trunk for a while, creating some incompatibilities with my current
project.
You mentioned the plan was/is to merge it into 1.1 of AS.
Do you perhaps have any updates? I.e. time frame for merge with trunk
either in the direction of the branch or in the direction of the
trunk.
Thanks, Frank.
Guillaume.
One problem I have is using a HABTM relationship with the "attactment"
It keeps trying to force an id of 1 in the join table. So the first
create will work, but it'll never get beyond that.
so you re saying attachment_fu is compatible with tje upload branch of
AS ?
I ve seen some explaination of attachment_fu, and they all talking
about image etc..; do you know if i can use it to store things like
video (i only want to store them where i want in the public folder, i
have no need of resizing etc.. ) ?
thanks in advance,
Guillaume.
In your controller:
active_scaffold :picture do |config|
config.create.multipart = true
config.update.multipart = true
config.create.columns = [:uploaded_data]
end
Model:
class Picture < ActiveRecord::Base
has_and_belongs_to_many :products
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 3.megabytes,
:resize_to => '400x400>',
:thumbnails => {:medium => '200x200>', :small =>
'100x100>'},
:path_prefix => 'public/images/products'
validates_as_attachment
end
Helper:
def uploaded_data_form_column(record, input_name)
file_field_tag input_name
end
That should do it.