Your problem is that you're using <edit-page/>. What you really want
is the form for the object. Try this:
<collection: replace>
<% this.announcements[0] ||= Announcement.new %>
<repeat:announcements>
<form/>
</repeat>
</collection>
This will give you an inline form for both the "new" and the "edit"
case. If you prefer a link, you can use something much like your old
code. Of course, if you have more than one announcement, this will give
you more than one form -- you'll probably want to add a validation to
enure that this cannot happen.
Bryan
Tharwat wrote:
I would like to limit my application to the creation of a single
record for one of my models.
Then on the index page for the model display the new button if there
are no records in the model. Else display the edit page.
I'm think something like this will work, but I'm new to Hobo and Ruby
<index-page>
<collection: replace>
<div>
<if:announcements.collectio>
<edit-page/>
</if>
<else>
<a action="new" to="&model" param="new-link">
<ht key="announcements.actions.new">New
Announcement</ht>
</a>
</else>
</div>
</collection:>
</index-page>
--
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.