Can anyone recommend a good file upload plugin for uploading standard files (more than one file per article / project), but I am not interested in images or image processing, just a standard uploader for files! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
attachment_fu is nice. http://svn.techno-weenie.net/projects/plugins/attachment_fu/README --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
* MaD <mayer.dominik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [2009-01-07 06:17:27 -0800]:> > attachment_fu is nice. > http://svn.techno-weenie.net/projects/plugins/attachment_fu/READMEI guess here''s the latest version: http://github.com/technoweenie/attachment_fu/tree/master> > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > -~----------~----~----~----~------~----~------~--~----- jan=callcc{|jan|jan};jan.call(jan)
> I guess here''s the latest version:http://github.com/technoweenie/attachment_fu/tree/masteroh, i''m sorry. i still got some old bookmarks on svn instead of github. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
MaD wrote:>> I guess here''s the latest version:http://github.com/technoweenie/attachment_fu/tree/master > > oh, i''m sorry. i still got some old bookmarks on svn instead of github.perfect, got it installed and trying to figure out how to get it working.. project controller in create, @project_file = Project_File.new(params[:uploaded_data]) in project view, <%= f.file_field :uploaded_data %> the page loads and i can select a file but when i go to save im getting the error, ActiveRecord::UnknownAttributeError in ProjectsController#create unknown attribute: uploaded_data project has_many :project_files project_file belongs_to :project any ideas? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 07 Jan 2009, at 16:39, Dave Smith wrote:> the page loads and i can select a file but when i go to save im > getting > the error, > > ActiveRecord::UnknownAttributeError in ProjectsController#create > unknown attribute: uploaded_dataThere are two parts of the upload form that differ from typical usage. 1. Include '':multipart => true'' in the html options of the form_for tag. Example: <% form_for(:attachment_metadata, :url => { :action => "create" }, :html => { :multipart => true }) do |form| %> 2. Use the file_field helper with :uploaded_data as the field name. Example: <%= form.file_field :uploaded_data %> I suspect you didn''t include the multipart option. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Example: > <% form_for(:attachment_metadata, :url => { :action => > "create" }, :html => { :multipart => true }) do |form| %> > > 2. Use the file_field helper with :uploaded_data as the field name. > Example: > <%= form.file_field :uploaded_data %> > > I suspect you didn''t include the multipart option. > > > Best regards > > Peter De BerdtHi Peter, Many thanks for your answer, I have included this in my code. This is my entire new.html.erb file. <% form_for(@project, :html => {:multipart => true}) do |f| %> <%= f.error_messages %> <p> <%= f.label :name %><br /> <%= f.text_field :name %> </p> <p> <%= f.label :description %><br /> <%= f.text_field :description %> </p> <p> <%= f.label :date_due %><br /> <%= f.calendar_date_select :date_due %> </p> <p> <%= f.file_field :uploaded_data %> </p> <p> <%= f.submit "Create" %> </p> <% end %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <p> > <%= f.label :description %><br /> > <%= f.text_field :description %> > </p> > <p> > <%= f.label :date_due %><br /> > <%= f.calendar_date_select :date_due %> > </p> > <p> > <%= f.file_field :uploaded_data %> > </p> > <p> > <%= f.submit "Create" %> > </p> > <% end %>i forgot to state, that i already had the multipart code in there. so i dont thin the problem is that -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
does anyone have any ideas? projects controller def create @project = Project.new(params[:project]) @project.company_id = get_user.company.id @project.status_id = 2 @project_file = Project_File.new(params[:uploaded_data]) respond_to do |format| if @project.save flash[:notice] = ''Project was successfully created.'' format.html { redirect_to(@project) } format.xml { render :xml => @project, :status => :created, :location => @project } else format.html { render :action => "new" } format.xml { render :xml => @project.errors, :status => :unprocessable_entity } end end end new project view <% form_for(@project, :html => {:multipart => true}) do |f| %> <%= f.error_messages %> <p> <%= f.label :name %><br /> <%= f.text_field :name %> </p> <p> <%= f.label :description %><br /> <%= f.text_field :description %> </p> <p> <%= f.label :date_due %><br /> <%= f.calendar_date_select :date_due %> </p> <p> <%= f.file_field :uploaded_data %> </p> <p> <%= f.submit "Create" %> </p> <% end %> <%= link_to ''Back'', projects_path %> project_file model belongs_to :project has_attachment :storage => :file_system, :path_prefix => ''public/files'', :partition => false validates_as_attachment error message ActiveRecord::UnknownAttributeError in ProjectsController#create unknown attribute: uploaded_data RAILS_ROOT: /Users/louisbacon/Sites/codepress Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2587:in `attributes='' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2583:in `each'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2583:in `attributes='' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2283:in `initialize'' app/controllers/projects_controller.rb:61:in `new'' app/controllers/projects_controller.rb:61:in `create'' thanks a bunch -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 08 Jan 2009, at 15:33, Dave Smith wrote:> @project_file = Project_File.new(params[:uploaded_data])ProjectFile seems more like an ActiveRecord class name. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt wrote:> On 08 Jan 2009, at 15:33, Dave Smith wrote: > >> @project_file = Project_File.new(params[:uploaded_data]) > > ProjectFile seems more like an ActiveRecord class name. > > > Best regards > > Peter De BerdtYou''ll have to excuse me for my lack of knowledge here but I dont understand? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 08 Jan 2009, at 16:11, Dave Smith wrote:> Peter De Berdt wrote: >> On 08 Jan 2009, at 15:33, Dave Smith wrote: >> >>> @project_file = Project_File.new(params[:uploaded_data]) >> >> ProjectFile seems more like an ActiveRecord class name. >> >> >> Best regards >> >> Peter De Berdt > > You''ll have to excuse me for my lack of knowledge here but I dont > understand?script/generate model ProjectFile class ProjectFile < ActiveRecord::Base No underscores in model names, that''s not the convention. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 08 Jan 2009, at 16:11, Dave Smith wrote:> You''ll have to excuse me for my lack of knowledge here but I dont > understand?Also, I do hope you have a has_attachment statement in your ProjectFile model? Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 08 Jan 2009, at 15:33, Dave Smith wrote:> > @project_file = Project_File.new(params[:uploaded_data])The solution is even more obvious: ProjectFile.new(params[:project][:uploaded_data]> new project view > <% form_for(@project, :html => {:multipart => true}) do |f| %> > <%= f.file_field :uploaded_data %> > <% end %>And to be honest, this is not really good code either. You are manually assigning related record ids instead of relying on Rails'' built-in safeguards. I''d advise u to start looking at railscasts.com, starting for very early ones (complex forms might be a good one for you), getting a Rails book (The Rails Way, Agile Web Development with Rails) and getting to know the framework better. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dave Smith wrote:> Can anyone recommend a good file upload plugin for uploading standard > files (more than one file per article / project), but I am not > interested in images or image processing, just a standard uploader for > files!Look for paperclip at thoughbot or github. It works perfectly well, and can handle any type of files. -- Video training with screencasts at http://www.digiprof.fr -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > And to be honest, this is not really good code either. > > You are manually assigning related record ids instead of relying on > Rails'' built-in safeguards. > > I''d advise u to start looking at railscasts.com, starting for very > early ones (complex forms might be a good one for you), getting a > Rails book (The Rails Way, Agile Web Development with Rails) and > getting to know the framework better. > > > Best regards > > Peter De BerdtHi Peter, Many thanks for your extensive help on this one. I now have @project_file = ProjectFile.new(params[:project][:uploaded_data]) in my projects controller. <%= f.file_field :uploaded_data %> but it still says ActiveRecord::UnknownAttributeError in ProjectsController#create unknown attribute: uploaded_data -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 08 Jan 2009, at 18:35, Dave Smith wrote:>> You are manually assigning related record ids instead of relying on >> Rails'' built-in safeguards. >> >> I''d advise u to start looking at railscasts.com, starting for very >> early ones (complex forms might be a good one for you), getting a >> Rails book (The Rails Way, Agile Web Development with Rails) and >> getting to know the framework better. > > Many thanks for your extensive help on this one. I now have > > @project_file = ProjectFile.new(params[:project][:uploaded_data]) > > in my projects controller. > > > <%= f.file_field :uploaded_data %> > > but it still says > > ActiveRecord::UnknownAttributeError in ProjectsController#create > > unknown attribute: uploaded_dataYes it will. The problem is this: your new project file object expects the attribute :uploaded_data to be present in the hash you are passing it. @project_file = ProjectFile.new(params[:project]) This will pass in a hash that''s too large (since it also holds your project related attributes, but it will probably save the object for you. That''s the reason you need to get familiar with fat models, skinny controllers. It will make mass assignments and related object creation so much easier. The only code that should be in your controller is that to assign the instance variable with a newly created object. I would then let my model handle the object creation, including the related record. In fact, that is the exact thing the model is there for. def create @project = Project.create(params[:project]) end Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
attachment_fu, file_column, paperclip (nice railscast) Ifo you need multiple concurrent uploads, go for something in flash... Cheers, Sazima On Jan 7, 12:13 pm, Dave Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Can anyone recommend a good file upload plugin for uploading standard > files (more than one file per article / project), but I am not > interested in images or image processing, just a standard uploader for > files! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sazima wrote:> attachment_fu, file_column, paperclip (nice railscast) > > Ifo you need multiple concurrent uploads, go for something in flash... > > Cheers, Sazima > > On Jan 7, 12:13�pm, Dave Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>thank you all for your help! its greatly appreciated! ive gone with another method of multiple attachments using attachment fu, and am learning fat models and skinny controllers to help in general. http://www.practicalecommerce.com/blogs/post/432-Multiple-Attachments-in-Rails cheers folks dave -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Responding to the subject line: Please register another vote for Paperclip; it rules! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---