
[Patch] Property aliases
Reported by John W Higgins | February 20th, 2008 @ 09:59 PM
The attached patch allows for properties to be aliased in the model. For example if you had a field called "custID" in the database but you wanted to use a more descriptive name such as customer_id - this patch allows you to have a getter and setter using customer_id which works on the custID column.
The property spec file is also patched and included for coverage.
Comments and changes to this ticket
-
Dan Kubb (dkubb) April 15th, 2008 @ 02:45 AM
- Milestone cleared.
-
Sam Smoot April 28th, 2008 @ 12:35 PM
- State changed from new to invalid
This is already a core DM feature. property :customer_id, Fixnum, :field => 'custID'
-
Adam French April 28th, 2008 @ 12:37 PM
I'll make not of this in the docs for Property so that the world may know that such is supported.
-
Sam Smoot April 29th, 2008 @ 08:31 AM
- Assigned user set to Adam French
- State changed from invalid to open
Adam, can you update your commit to use an 80-char hard wrap per these guidelines? http://merbivore.com/contribute....
-
Sam Smoot May 2nd, 2008 @ 04:34 AM
- State changed from open to resolved
Adam made this update. Closing this out.
-
Justin Cranshaw November 14th, 2012 @ 01:06 PM
- Tag set to patch, property
- Milestone order changed from 0 to 0
I know this is closed, but I think there is value to allowing proper ruby-style aliasing, and :field does not accomplish this. For example, if you had a database column called "lon", it would be nice to have in your model
property :lon, Float
alias :lng :lon
alias :longitude :lon
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »