In my controller I have:
  # PUT /clubs/1
  # PUT /clubs/1.xml
  def update
    @club = Club.find(params[:id])

        if params[:club][:logo_big] && params[:club][:logo_big].size > 0
      @club.logo_big = params[:club][:logo_big].read
    end

    respond_to do |format|
      if @club.update_attributes(params[:club])
        flash[:notice] = 'Club was successfully updated.'
        format.html { redirect_to(@club) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @club.errors, :status
=> :unprocessable_entity }
      end
    end
  end

  def image
        data = Club.find(params[:id]).data
        send_data data, :disposition => 'inline'
  end

In my edit view I have:

<% form_for (@club, :html => { :multipart => true }) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.file_field :logo_big %></p>
  <p class="submit_button">
    <%= f.submit 'Update' %>
  </p>
<% end %>

My DB has a table called clubs with a BLOB field called logo_big

When I click update I get an error along the lines of: "private method
`gsub' called for #<Tempfile:0x7213138>"

What am i doing wrong? Did I mess up the syntax of the form? I'm
working off the generated views that Rails provides.

On Aug 8, 4:48 pm, Xenio <[email protected]> wrote:
> I have a DB that is already populated with data. There is a table
> called clubs that has an logo_big field set up as a blob. I have
> successfully used send_data to display the jpg pictures as I need them
> in the views. I just need to setup the edit/new view to enable me to
> upload the files.
>
> I tried paperclip but that requires changing the schema of the
> database which is not really an option for me.
>
> I am looking for a simple implementation to change the image file.
>
> I have been hunting around the "to_blob" and "send_data" parameters
> with no luck. Any help with this?

-- 
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.

Reply via email to