Hi
  This is an implementation question. I have the STI models like
Class FileCabinet < ActiveRecord::Base
end
Class TenantFileCabinet < FileCabinet
end
Class CompanyFileCabinet < FileCabinet
end

    And file_cabinets table is

| id         | int(11)      | NO   | PRI | NULL    | auto_increment |
| company_id | int(11)      | YES  |     | NULL    |                |
| type       | varchar(255) | YES  |     | NULL    |                |
| tenant_id  | int(11)      | YES  |     | NULL    |                |


My documents table is below(I use paperclip)

|id                      | int(11)      | NO   | PRI | NULL    | auto_increment 
|
| attachment_file_name    | varchar(255) | YES  |     | NULL    |               
 |
| attachment_content_type | varchar(255) | YES  |     | NULL    |               
 |
| attachment_file_size    | int(11)      | YES  |     | NULL    |               
 |
| attachment_updated_at   | datetime     | YES  |     | NULL    |               
 |
| company_id              | int(11)      | YES  |     | NULL    |               
 |
| attachment_file         | longblob     | YES  |     | NULL    |               
 |

And between file_cabinet and documents there is has_many :through
relation. My document_file_cabinets table is

| id              | int(11)      | NO   | PRI | NULL    | auto_increment |
| document_id     | int(11)      | YES  |     | NULL    |                |
| file_cabinet_id | int(11)      | YES  |     | NULL    |                |
| deleted         | tinyint(1)   | YES  |     | 0       |                |
| company_id      | int(11)      | YES  |     | NULL    |                |
| document_name   | varchar(255) | YES  |     | NULL    |                |

        My purpose is to add documents to company file cabinet (those
can be done and viewed by company admin) and each tenant also have there
own file cabinet. To which documents are added by admin. My question is
since this an STI which controller should I use and how? Is it file
cabinet controller OR company_file_cabinets_controller and
tenants_file_cabinets_controller? Please guide me.

Thanks in advance
Tom
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to