Forum: Ruby on Rails Restful Controllers session state and custom actions.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Michael D. (Guest)
on 2009-02-09 10:34
hi,
i'm working with a model with a has_many association. i'm using the
complex forms (ala ryan bates) design. it's been straight forward i've
just followed that particular design, using a map.resources route, & 7
action controller.

The models are:

Booking
has_many :booking_items

when adding booking_items its a fairly lengthy process, i need to page
the form for selecting items etc, so up to now i've been saving the
Booking with a State='Created' (AASM). and editing the model until the
user pays at which point i move the model into a 'Paid' state.

But to try n simplify it i've decided to put the model in session state
and once its ready to be created i then follow the usual path, or 'post'
to 'create' etc.

my question is, when adding booking_items to my booking in session state
i'm posting to a custom action on my controller, and when clearing
session (for a 'Start Again' button) again i'm posting to a custom
method which clears the session.

it doesnt really feel right but i'm not really sure of any alternatives,
has anyone got any advise?

cheers.
This topic is locked and can not be replied to.