Stack Exchange
Form Object construction with rails 3
i have got an edit form that is suppose to update the booking, b_equipments and b_menus models respectively:
= form_for :booking, :url => "", :html => {:id => "edit_menu_form"} do |form|

    .formsection.f2.x

     %p.x
        = label :booking, :serving_time, "Serving Time (hh:mm)"
        = form.text_field :serving_time



= form.submit "Update"



class BookingsController < ApplicationController

def update
    @booking = Booking.find_by_id(params[:id])
    # debugger
    #  puts "========\n\n\n this room #{@booking} is being updated \n\n\n======="
    # puts "========\n\n\n#{@booking.update_attributes(params[:booking])} \n\n\n======="
    @room = Room.find_by_id(@booking.room_id)
    @bookings = []
    @bookings << Booking.find(@booking)

    @booking_ids = Booking.find_bookings_ids(@bookings).join(",")
    #debugger

    puts "========\n\n\n#{@booking} \n\n\n======="
    if @booking.update_attributes(params[:booking])
      params[:next] = "Next"
      flash.now[:notice] = 'Booking was successfully updated.'
      #@booking = @booking
      render :action => :edit
    else
      flash.now[:error] = 'Failed to update booking'
      render :action => :edit
    end
 #   Rails.logger.info("========\n\n\ PARAMS: \n\n\n======
    #   #{params.inspect} \n\n\n======")
  end




class Booking < ActiveRecord::Base
  has_many :b_equipments

  has_many :b_menus

  end

At the moment this form consists of several fields from the three models (booking, b_equipments and b_menus), but coming from a java background i would like to compose or merge all the attributes into the booking model in my booking_controller update method.. but i lack the relevant rails experience to get this done.
THANKS IN ADVANCE

Sorry, this isn't Java. When ruby holds a database object, you will only be able to carry the attributes to that object. 
It would seem that you are making this too complex. 
   In the model you have has_many :b_equipments & has_many :b_menus
So that if you are looking to add information to those objects associated to your @booking object you can do something like this
arr_of_menus = @booking.b_menus
 arr_of_menus[0].attribute = params[:menu_thing1]

or 
arr_of_menus = @booking.b_menus
 arr_of_menus[0].update_attributes(params[:menu_thing1])

You are giving Ruby on Rails a lot of credit, but even it can only expect the attributes associated in the database.
