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

alias gid group_id #34

Closed
doon opened this issue Aug 25, 2014 · 11 comments
Closed

alias gid group_id #34

doon opened this issue Aug 25, 2014 · 11 comments

Comments

@doon
Copy link

doon commented Aug 25, 2014

Upgrading an internal app to Rails 4.2 beta, and this alias hit me pretty hard. The app deals with file system permissions and as gid is the numeric group id, it is used heavily in modeling file system users.. Since now all my AR models can't use gid as an field anymore. so lots of renaming columns. Tried aliasing it, but that didn't work (as expected) Not sure if I should post this here or Active Record? Figure since this is where it is defined. I am probably not the only person to be bit by this. No real work around, that I can see..

@seuros
Copy link
Member

seuros commented Aug 25, 2014

👍
We should rename that. That will impact LDAP users too.

@dhh
Copy link
Member

dhh commented Aug 25, 2014

I’m not so sure. Anything we pick can potentially have side effects, and I don’t want to end up with model#__gid or something like that.

Let’s give people a graceful way of handling the conflict, though.

On Aug 26, 2014, at 7:40 AM, Abdelkader Boudih notifications@github.com wrote:

We should rename that. That will impact LDAP users too.


Reply to this email directly or view it on GitHub.

@matthewd
Copy link
Member

Isn't global_id sufficient? Are we really expecting people to manually call it often enough to warrant squatting on such a short name? 😕

And sgid? A library should presumably call the longer/safer name, so is that just for the application author? Because I'm quite sure I would never remember what some_model.sgid was. signed_global_id, on the other hand, is nice and obvious.

@dhh
Copy link
Member

dhh commented Aug 25, 2014

I started with the long name, and then found it really annoying when used in stuff like options for select and so forth. But it wouldn’t be the end of the world to go with that. I can take another stab at making a feel for it in our app.

On Aug 26, 2014, at 8:04 AM, Matthew Draper notifications@github.com wrote:

Isn't global_id sufficient? Are we really expecting people to manually call it often enough to warrant squatting on such a short name?

And sgid? A library should presumably call the longer/safer name, so is that just for the application author? Because I'm quite sure I would never remember what some_model.sgid was. signed_global_id, on the other hand, is nice and obvious.


Reply to this email directly or view it on GitHub.

@doon
Copy link
Author

doon commented Aug 26, 2014

I am not sure what to use either, no matter what you pick there are going to be conflicts, especially with short names since all the good ones are taken (kinda like domain names). To me I see gid causing a decent amount of conflicts due to its use in posix/unix like systems. And yes model#__gid would be horrible, but what about something like g_id? Still not sure I like it,, but way better than __gid.. Currently i just changed my code to be u_gid and u_uid, but when I deploy this to production, going to have to change a bunch of external systems that use these tables as well

@chancancode
Copy link
Member

I say we go with global_id. Seems like the likelihood of collision is fairly low, and if you don't already use gid and prefers a shorter name, you can just add the alias in your application

@chancancode
Copy link
Member

Another alternative is 'to_gid' which draws a parallel to 'to_param'. But 'global_id' probably still my first pick. And feiw I agree with Matthew that sgid is 👎

@jeremy
Copy link
Member

jeremy commented Aug 26, 2014

Thought about this too. I actually thought more ppl would collide with global_id considering it's what a foreign key to a Global would be named!

@chancancode
Copy link
Member

belongs_to :global (face)

@dhh
Copy link
Member

dhh commented Aug 26, 2014

I actually like #to_gid. It's a serialization format, so that makes sense to me. Another parallel is #to_json. I say we go with #to_*.

On Aug 26, 2014, at 16:05, Godfrey Chan notifications@github.com wrote:

belongs_to :global (face)


Reply to this email directly or view it on GitHub.

@kaspth
Copy link
Contributor

kaspth commented Sep 10, 2014

Fixed in 8f893e1.

@kaspth kaspth closed this as completed Sep 10, 2014
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

Successfully merging a pull request may close this issue.

7 participants