# Restful Controllers session state and custom actions

**URL:** <https://www.ruby-forum.com/t/restful-controllers-session-state-and-custom-actions/159834>\
**Category:** Rails\
**Created:** [February 9, 2009, 9:34am UTC](https://www.ruby-forum.com/t/restful-controllers-session-state-and-custom-actions/159834 "2009-02-09T09:34:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdeering](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/278dde/32.png) [@mdeering](https://www.ruby-forum.com/u/mdeering)\
**Post date:** [February 9, 2009, 9:34am UTC](https://www.ruby-forum.com/t/restful-controllers-session-state-and-custom-actions/159834/1 "2009-02-09T09:34:33Z")

</div>

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.
