Warning, I am new to ruby on rails. I know my database isn't setup all that great, but we're pulling in from a remote database and storing information from that database.
Users:
- id
- ...
stations
- id
- user_id
- hex_key (unique)
- ...
calls
- id
- reported by (hex key from stations)
- data source id (from remote database)
call details
- id
- call_index (data source id from calls)
responses
- id
- call_index (data source id from calls)
- response_id (from remote database)
response details
- id
- response_index (response_id from responses)
As far as the models go (this is all I have completed so far) I think this is also my biggest problem:
user has many stations, calls through stations and reports through calls
stations has many calls
calls has many responses and belongs to stations
response belongs to a call
I've been trying to figure this out, but how do i model this so i can get everything from the users correctly. something like this:
@user.responses.find(:all)
and that would give all the responses for that user