Take a look at http://github.com/thoughtbot/paperclip

Darian Shimy
--
http:/www.darianshimy.com
http://twitter.com/dshimy


On Mon, Nov 16, 2009 at 12:19 PM, Todd A. Jacobs <
[email protected]> wrote:

>
> Can anyone point me to a howto that shows the absolute minimum needed
> for file uploads to a database binary column using native RoR? I've
> googled around, and all the results seem to be about plugins like
> paperclip or attachment_fu, or complex examples that don't seem to
> address a very basic need.
>
> I currently have a schema with:
>
>  create_table "attachments", :force => true do |t|
>    t.integer  "user_id"
>    t.integer  "property_id"
>    t.binary   "file"
>    t.datetime "created_at"
>    t.datetime "updated_at"
>  end
>
> and a scaffolded controller with a view containing:
>
>    <% form_for @attachment, :html => {:multipart => true} do |f| %>
>      <%= f.error_messages %>
>        <!-- other stuff snipped -->
>        <%= f.label :file %><br />
>        <%= f.file_field :file %>
>      </p>
>      <p>
>        <%= f.submit 'Create' %>
>      </p>
>    <% end %>
>
> Uploading a file tells me:
>
>    NoMethodError in AttachmentsController#create
>    private method `gsub' called for
>    #<File:/tmp/RackMultipart20091116-1557-wrrxpn-0>
>
> but I can't find *any* useful documentation as to what needs to go into
> the create action to pull it all together. I don't want to do anything
> complicated; I just want to store the binary in the database for later
> retrieval.
>
> --
> "Oh, look: rocks!"
>        -- Doctor Who, "Destiny of the Daleks"
>
>
> >
>

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