You want the accessible on the join table I believe.  You're not creating 
new prices, just new joins.

On Saturday, March 24, 2012 8:58:39 AM UTC-6, LadyBug 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 
> athttp://cookbook.hobocentral.​net/manual/multi_model_forms<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 view this discussion on the web visit 
https://groups.google.com/d/msg/hobousers/-/-MYK7TCP55YJ.
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