It's a bit difficult to help you without the code here. Looks like
you're not performing the correct assignment in your controller.
content_type is a method that can only be called on a UploadedStringIO
object and somehow you're typecasting it to Array it seems.
Please show us the code for your controller update action and your
edit view. And it also helps to tell us which params are being passed
when you call the action (from your development.log).
On Sep 3, 5:24 am, Tony Tony <[EMAIL PROTECTED]> wrote:
> Jodi Showers wrote:
> > Thanx for jumping in Degee -
>
> > On 29-Aug-08, at 11:23 AM,deegeewrote:
>
> >> wants to add an image, he gets to an image upload view. This would
> >> ...
> >> On 29 aug, 14:40, Tony Tony <[EMAIL PROTECTED]> wrote:
> >>>>> is appreciated!!
> >>>> add images to other models
> >>>> has_attachment :storage => :file_system, ...
> >>> undefined local variable or method `filename' for #<User:0x2564508>
> >>> format.xml { head :ok }
>
> >>> Any help is appreciated! Thanks.
>
> >>> -Tony
> >>> --
> >>> Posted viahttp://www.ruby-forum.com/.
>
> > I prefer to create images within the (in this case) the UserController.
>
> > ripped out of a project
>
> > View - <multipart form tag here>
>
> > <%= file_field_tag "photo[]", :id => "photo_image", :class =>
> > "attach_photo" %>
> > <%= text_field_tag "caption[]", nil, {:id => "photo_title", :class =>
> > "attach_photo"} %>
>
> > User controller - after @user object is valid + saved
>
> > #attached uploaded pics - an array of photos + captions
> > if params[:photo]
> > params[:photo].each_with_index do |image, caption_index|
> > caption = ''
> > caption = params[:caption][caption_index] if params[:caption]
> > && params[:caption][caption_index]
>
> > [EMAIL PROTECTED](:uploaded_data => image, :caption =>
> > caption) if image.size != 0
> > end
> > end
>
> > Jodi
>
> Thanks for all the help guys.
>
> I finally got back to work after being busy from my day job. I got the
> filename situation cleared but now I get the following error:
>
> undefined method `content_type' for
> [#<ActionController::UploadedStringIO:0x23f8e1c>, 0]:Array
>
> I'm doing things the "Jodi way". Maybe I'm just tired and can't see the
> obvious solution but any advice is really appreciated as always.
>
> And yes, I realize that this info is being spoon fed to me and I STILL
> can't get it. Trust me, it's more frustrating to me than it is to anyone
> else! :-\
>
> Thanks again all!!!
>
> -Tony
> --
> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---