Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use document_type instead of couchrest-type by default #3

Open
tapajos opened this issue Jul 1, 2010 · 2 comments
Open

Use document_type instead of couchrest-type by default #3

tapajos opened this issue Jul 1, 2010 · 2 comments

Comments

@tapajos
Copy link
Member

tapajos commented Jul 1, 2010

Issue from: http://github.com/couchrest/couchrest/issues#issue/25

Documents should not know about "driver" and store odd fields like couchrest-type. IIRC it was already discussed several months ago, but unfortunately I can not find a thread. The idea:

  • Use document_type field name by default
  • Use global ExtendedDocument.set_inheritance_field "couchrest-type" for legacy
  • Use ExtendedDocument.set_inheritance_field in any class

My fork http://github.com/wildchild/couchrest/commits/document_type

Related ticket: http://jchris.lighthouseapp.com/projects/17807/tickets/22-lets-use-couchrest_type

Thoughts?

@samlown
Copy link
Member

samlown commented Jul 2, 2010

Interestingly, I also do not like the couchrest-type field and was thinking of ways to change it in CouchRest Model. My main reason for this is that I'm creating a couchapp which uses the same DB and having couchrest-type in all the views doesn't make much sense.

I think my preference would be to go minimal, and just use "type" as opposed to "document_type" by default. Most Rails developers are used to not using the 'type' field as it is used for STI. Anyone else can change it to something more complicated.

I do however think we should offer a migration script for people who want to change the column name.

@samlown
Copy link
Member

samlown commented Jul 2, 2010

Having closed this ticket:

http://github.com/couchrest/couchrest_extended_document/issues#issue/5

It dawned on me that allow the type to change per model as shown in the lighthouseapp ticket is a really bad idea. This has to be a global setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants