Hey everyone. I haven't posted in a while:then again i had to set web-
design aside for a while to finish my undergrad - hooray for a
mechanical engineering degree!!!

So i'm working on a new site for a friend. Just getting started again
and trying to get things figured out. I'm messing with
paperclip_with_hobo again and have it almost working.

I can upload photos, but I can't seem to view the file on the show
page. It just gives me the title instead of the image! I can adjust
the fields to get the other information like file size, uploaded at,
etc. but can't seem to get it to show the image!! here's the relevant
part of application.dryml. I have paperclip and paperclip_with_hobo
installed in the plugins directory.

<include src="paperclip" plugin="paperclip_with_hobo"/>

<extend tag="form" for="Skank">
  <old-form merge multipart>
    <field-list: fields="title, event, photo"/>
  </old-form>
</extend>

<def tag="show-page" for="Skank">
  <page merge title="Skank">
    <body: class="show-page skank" param/>
    <content: param>
          <header param="content-header">
            <h2 param="heading"><name/></h2>
            <a action="edit" if="&can_edit?" param="edit-link">Edit
Skank</a>
          </header>
          <section param="content-body">
            <field-list fields="photo, title, event" param/>
          </section>
    </content:>
  </page>
</def>

<def tag="index-page" for="Skank">
  <page merge title="Skanks">
    <body: class="index-page skank" param/>
    <content: param>
      <header param="content-header">
        </header>
      <section param="content-body">
        <div> <collection fields=":photo, :title, event" param/></div>
      </section>
    </content:>
  </page>
</def>

<def tag="card" for="Skank">
 <card class="skank">
  <div>
   <body:>
        <a alt="<name/>"><%= image_tag this.photo.url(:small) %></a>
   </body:>
  </div>
 </card>
</def>

here's the model:
class Skank < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    timestamps
    title :string
    event :string
  end

  has_attached_file :photo

  # --- Permissions --- #

  def create_permitted?
    acting_user.administrator?
  end

  def update_permitted?
    acting_user.administrator?
  end

  def destroy_permitted?
    acting_user.administrator?
  end

  def view_permitted?(field)
    true
  end

end

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