This should work (assuming you don't want to join between bookings and 
car_bookings, and you're happy just to duplicate the common elements in the 
schema):

class Booking
  include DataMapper::Resource
  
  storage_names[:default] = 'bookings'
end

class CarBooking < Booking
  storage_names[:default] = 'car_bookings'
end

CarBooking will come from the car_bookings table, and will have all of the 
columns in Booking, plus any that it defines itself.

If you want a schema where car_bookings only has the fields that do not exist 
in bookings (e.g.

bookings
  - id
  - customer_id
  - created_at

car_bookings
   - booking_id
   - manufacturer
   - year
)

then this is generally not a great idea as it gets out of hand quickly.


On 29/06/2011, at 21:32, Juan wrote:

> No I think one table for class, but getting the model in an heritance.
> 
>   class Booking
>     include DataMapper::Resource
> 
> 
>   end
> 
>   class CarBooking < Booking
> 
>   end
> 
> But store the objects of each class in a different database tables.
> 
> Can I?
> 
> Thanks
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" 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/datamapper?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to