Hi Sergio,

thanks for your reply. Following your advice it was actually easy to
make it work.

Just for completeness, I added some slight modifications, allowing the
controller to be used for creating regular new orders (without being
intialized) an for reorderswhere the create form is actually
initialized with the values from the exiting order:

def do_new
    @params_id = params[:id]
    if @params_id.present?
      @record = Order.find(@params_id)
      @record.quantity = nil
      @record.clone
    else
      @record = Order.create
    end

So I do check if there actually is an id passed in the params hash. If
the id is present, then I find the old record using the id in the
find, I reset the quantity to nil and then clone it. If there is no id
in the params hash, then I create a new Order object so the regular
create action does work.

def before_create_save(record)
    record.user_id = @current_user.id
    record.created_at = Time.now
  end

Here is simply set the other two fields to my needs.

Thanks again!
Keep up the good work
Cheers Juergen

works like a charm.

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to