Here's the code extracted from my working paperclip.  It uses s3 but
you get the idea.

from the Picture model:

has_attached_file :image,
      :styles => {
        :original => ["1000x1000", :jpg ],
        :medium => ["500x800", :jpg ],
        :small => ["300x500", :jpg ],
        :thumbnail => ["100x100#", :jpg ]
      },
      :default_style => :medium,
      :storage => :s3,
      :path => ":style/:id_:basename.:extension",
      :s3_credentials => S3_KEYS,
      :s3_headers => {'Expires' => 10.year.from_now.httpdate},
      :bucket => 'fantasy-earth-roleplaying-uploads'

and from application.dryml:

<include src="paperclip" plugin="paperclip_with_hobo" />
<extend tag="form" for="Picture">
  <old-form enctype="multipart/form-data" merge>
    <field-list: fields="name,description,license,notes,image" />
  </old-form>
</extend>
<extend tag="card" for="Picture">
  <card>
    <h5><a /></h5>
    <p>
      <a><img src="#{this.image.url :thumbnail}" /></a>
      <view:description />
    </p>
    <p>
      Uploaded:<br />
      <view:created_at format="%B %d, %Y" /> by <you:user />.
    </p>
    <delete-button class="actions" />
    <report-content-link />
  </card>
</extend>

On Sep 29, 2:57 pm, Jaonary Rabarisoa <[email protected]> wrote:
> Hi all,
>
> I'm desperatly trying to get paperclip work with my application. I followed
> exactly what is described by Gert Thiel 
> herehttp://github.com/GertThiel/paperclip_with_hobo/blob/master/README.ma...
> apparently there's something that I missed.
> First off all, it seems that the tag definition that I put into my
> application.dryml is not taken into account and the form that correspond to
> my photo never appears. It only appears when I modify directly the tag
> definition in the file rapid/form.dryml. When doing like this, I can browse
> my computer and put a filename in the form. But when I save it, nothing
> happens.
>
> Below is the definition of my class :
>
> class Profile < ActiveRecord::Base
>
>   hobo_model # Don't put anything above this
>
>   fields do
>
>         firstname :string
>         name :string
>
>         title :string
>     presentation :text
>         #presentation  :markdown #:textile
>
>         publish :boolean
>
>     timestamps
>   end
>
>     has_attached_file :photo,
>                 :path => ":rails_root/public/images",
>                 :style => {:medium => "300x300>", :thumb => "100x100>"}
>
>     belongs_to :owner, :class_name => "User", :creator => true
>
> And here is my application.dryml
>
> <include src="paperclip" plugin="paperclip_with_hobo"/>
>
> <def tag="app-name">SCY Plus</def>
>
> <def tag="input" for="Paperclip::Attachment">
>     <%= file_field_tag param_name_for_this, attributes %>
> </def>
>
> <def tag="form" for="Profile">
>   <form merge multipart param="default">
>     <error-messages param/>
>     <field-list fields="firstname, name, title, presentation, photo" param/>
>     <div param="actions">
>       <submit label="Save" param/><or-cancel param="cancel"/>
>     </div>
>   </form>
> </def>
>
> If anybody could tell me what I'm doing wrong it would be helpfull.
>
> Best regards,
>
> Jaonary
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to