paperclip_with_hobo not showing file field

4 views
Skip to first unread message

Jarin Udom

unread,
Apr 24, 2009, 5:50:44 PM4/24/09
to Hobo Users
I've installed the paperclip_with_hobo plugin and it generated the
database fields correctly on my Photo model, but when I go to add a
new Photo I get three string fields:

Photo File Name
Photo Content Type
Photo File Size

I've added <include src="paperclip" plugin="paperclip_with_hobo"/> to
my application.dryml as the readme suggested and no dice.

Any idea what I'm doing wrong here?

Jarin Udom

unread,
Apr 24, 2009, 6:02:36 PM4/24/09
to Hobo Users
Ok found it in a fork of the paperclip_with_hobo project. You have to
add something like this to your application.dryml:

<def tag="form" for="Photo">
<form merge multipart param="default">
<error-messages param/>
<field-list fields="photo, description" param/>
<div param="actions">
<submit label="Save" param/><or-cancel param="cancel"/>
</div>
</form>
</def>

http://github.com/GertThiel/paperclip_with_hobo/tree/master

Othmane Benkirane

unread,
Apr 25, 2009, 10:33:10 AM4/25/09
to hobo...@googlegroups.com
Hi,

I have experienced big troubles with STI : I have followed all the steps
described in the cookbook, but hobo_migration doesn't see the change (and it
doesn't see the sti_type added to the parent class either).

My whole application is attached (See the photo model).

Thank you for your help !

enkhy.zip

Bryan Larsen

unread,
Apr 25, 2009, 1:21:55 PM4/25/09
to Hobo Users
Are you using edge Hobo? At least one STI bug related to migrations
has been fixed recently.

Bryan
>  enkhy.zip
> 320KViewDownload

Othmane Benkirane

unread,
Apr 25, 2009, 2:36:11 PM4/25/09
to hobo...@googlegroups.com
Hi again,

Thank you for your help, hobo_migration works good now, and I have generated
my application fine. However, I don't see how I can do this :

- Hide the Child classes
- Just show the parent one
- When a new photo is created, the only thing which will determinate the
child class where the object will be saved will be a select (or whatever)
tag with the name of the child classes. Is it possible ?

Thank you for your help again.

PS: I haven't seen the child classes's tabs in the menu selection after the
migration, by the way (and the edited form in the parent class doesn't affect
the child one, which is annoying since I must do that because of
paperclip_with_hobo's bugs).

Bryan Larsen

unread,
Apr 25, 2009, 6:38:12 PM4/25/09
to Hobo Users


On Apr 25, 2:36 pm, Othmane Benkirane <e...@rhyhann.net> wrote:
> Hi again,
>
> Thank you for your help, hobo_migration works good now, and I have generated
> my application fine. However, I don't see how I can do this :
>
> - Hide the Child classes
> - Just show the parent one

Hide where? In the nav bar up top?

Most apps end up with a custom nav bar. Copy it from app/views/
taglibs/auto/rapid/pages.dryml and paste into app/views/taglibs/
application.dryml

> - When a new photo is created, the only thing which will determinate the
>   child class where the object will be saved will be a select (or whatever)
>   tag with the name of the child classes. Is it possible ?

You should be able to add an input tag to your form for your "type"
attribute.

>
> Thank you for your help again.
>
> PS: I haven't seen the child classes's tabs in the menu selection after the
> migration, by the way (and the edited form in the parent class doesn't affect
> the child one, which is annoying since I must do that because of
> paperclip_with_hobo's bugs).

Menu selection -- do you mean the nav bar? See above. Obviously,
I'm misunderstanding you for at least one of those...

cheers,
Bryan

Othmane Benkirane

unread,
Apr 26, 2009, 6:39:10 AM4/26/09
to hobo...@googlegroups.com
Hi,

> > Hi again,
> >
> > Thank you for your help, hobo_migration works good now, and I have generated
> > my application fine. However, I don't see how I can do this :
> >
> > - Hide the Child classes
> > - Just show the parent one
>
> Hide where? In the nav bar up top?
>
> Most apps end up with a custom nav bar. Copy it from app/views/
> taglibs/auto/rapid/pages.dryml and paste into app/views/taglibs/
> application.dryml

Yes, I was talking about the nav bar. However, the hidden child classes
is the current state.

> > - When a new photo is created, the only thing which will determinate the
> >   child class where the object will be saved will be a select (or whatever)
> >   tag with the name of the child classes. Is it possible ?
>
> You should be able to add an input tag to your form for your "type"
> attribute.

I will do that, thanks.

> >
> > Thank you for your help again.
> >
> > PS: I haven't seen the child classes's tabs in the menu selection after the
> > migration, by the way (and the edited form in the parent class doesn't affect
> > the child one, which is annoying since I must do that because of
> > paperclip_with_hobo's bugs).
>
> Menu selection -- do you mean the nav bar? See above. Obviously,
> I'm misunderstanding you for at least one of those...

Sorry for my English, it's not my native language and I just began learning
it three years ago.
However, my current application works as if there were no child classes at
all : They are hidden from the nav bar, hidden in the associated classes
(the class that they belong to doesn't mention them). I must manually type
their name in the adress bar to see them.

Thank you for your help,

Othmane Benkirane.

PS : I have attached the current application. If you don't want me to do that
again (if, for example, it's too heavy), just let me know. The parent class
is Photo and the child classes are DogPhoto and LitterPhoto.

Bryan Larsen

unread,
Apr 26, 2009, 9:13:59 PM4/26/09
to Hobo Users
> However, my current application works as if there were no child classes at
> all : They are hidden from the nav bar, hidden in the associated classes
> (the class that they belong to doesn't mention them). I must manually type
> their name in the adress bar to see them.

Hmmm, that's not really what I'm seeing. I'm not sure what's
happening in the nav-bar -- my child classes get trimmed because I
have too many models.

But in my app, submissions have_many files. File is the base class
for remittance_advice, batch_report, etc. But if I click on a file
in my submission, it displays it as a remittance_advice or whatever.

I don't think there's very much code in Hobo to have to do with STI --
it just renders the objects as it gets them. If you give it a Photo,
it renders a Photo even if it really is a DogPhoto.

>
> Thank you for your help,
> Othmane Benkirane.
>
> PS : I have attached the current application. If you don't want me to do that
> again (if, for example, it's too heavy), just let me know. The parent class
> is Photo and the child classes are DogPhoto and LitterPhoto.

I don't think it bothered anyone because it was stripped on the way
through Google Groups. :)

Bryan
Reply all
Reply to author
Forward
0 new messages