as far as I can tell from a quick read of your models and questions,
this will give you what you want.
<field-list: fields="registrations">
<registrations-view:>
<input-many>
<field-list fields="prices">
<prices-view:>
<select-many/>
</prices-view:>
</field-list>
</input-many>
</registrations-view>
</field-list:>
On Sat, Mar 24, 2012 at 10:58 AM, Lea Viljanen <[email protected]> wrote:
> I took a break from Rails & Hobo and now I'm soooo rusty. I have a couple of
> models and I have problems getting the creation right:
>
> class Event < ActiveRecord::Base
> ...
> has_many :registrations
> has_many :attendees, :through => :registrations, :accessible => true
>
> has_many :prices, :accessible => true, :dependent => :destroy
>
> end
>
> Attendee is a simple user-like model with
> has_many :registrations and
> has_many :events, :through => :registrations, :accessible => true.
>
> Registration:
> belongs_to :attendee, :accessible => true
> belongs_to :event
> has_many :registration_prices
> has_many :prices, :through => :registration_prices, :accessible => true
>
> Price:
> belongs_to :event
> has_many :registration_prices
> has_many :registrations, :through => :registration_prices
>
> The idea being that an event has several prices and when an attendee creates
> a registration he/she selects some or all of the prices. Checkboxing would
> be fine.
>
> Now, I can create the Attendee and the corresponding registration but for
> some
> reason I can't find a hobo way for the attendee to select the prices in the
> same
> registration creation form.
>
> I can display the event prices using <repeat with="&@event.prices"> in my
> new-for-event-page for="Registration", but getting those prices to be
> selectable in
> a form is escaping me. I've tried all kinds of tricks, including the nested
> <input-many>
> and <attendee-view:> + <prices-view:> tags hinted at
> http://cookbook.hobocentral.net/manual/multi_model_forms
>
> Right now my working Registration form in new-for-event-page is:
> <form with="&Attendee.new" param>
> <field-list: skip="event">
> </field-list:>
> <actions:>
> <submit label="#{ht 'registration.actions.save',
> :default=>['Save']}" param/>
> <or-cancel with="&@event" param="cancel"/>
> </actions:>
> </form>
>
> How do I add the price selection?
>
> --
> Lea 'LadyBug' Viljanen
>
> --
> 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.
--
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.