atmorell
atmorell

Reputation: 3068

Friendship invite form with hobo

The hobo lifecycle tutorial shows how to implement a friendship logic in the model and controller. However it does not really cover how to glue the gui/views together. When I go to /friendships/invite - hobo presents me with a form with a drop down menu. How do I add a form to the user show-page with just one button (Invite) I guess that the the user viewed should be in a hidden field?

I tried adding the form like this:

<extend tag="show-page" for="User">
  <old-show-page merge>
    <append-content-body:>
      <invite-form for="Friendship" />
    </append-content-body:>
  </old-show-page>
</extend>

Hobo ignores the invite-form hmmm I must be missing something.

Best regards Asbjørn Morell

Upvotes: 1

Views: 241

Answers (1)

Bryan Larsen
Bryan Larsen

Reputation: 10006

try <invite-form:friendships.build/> assuming you have has_many :friendships on your user model. for is an attribute on the 'def' and 'extend' tags, it's not recognized by 'form'. To use a polymorphic tag, simply pass in an instance of the correct type in the context. This of course is easier if an instance already exists, but since you're using a creator action, just build one.

P.S. Questions like this get answered much quicker on the Hobo Users mailing list.

Upvotes: 1

Related Questions