I don't use it intentionally but I'd prefer it to raise in case someone
tries to use it by mistake.
I simply don't understand why this method is defined by Sequel::Model:
http://sequel.jeremyevans.net/rdoc/classes/Sequel/Model/InstanceMethods.html#method-i-id
I don't want to alias it to pk either.
On 11-07-2014 10:57, Christian MICHON wrote:
Why not aliasing methods in your custom code only?
I never used the id method. Why would you use it for?
On Jul 11, 2014 9:42 PM, "Rodrigo Rosenfeld Rosas" <[email protected]
<mailto:[email protected]>> wrote:
I understand that this could be desired in an era where Ruby used
to define Object#id, but currently I'd prefer my models to raise a
NoMethodError if someone tries to acess #id from a model where the
primary key has another name instead of simply returning nil.
Fail-fast is a good strategy to prevent errors as soon as possible.
Having said that, can you foresee any problems with something like:
class MyModel < Sequel::Model
set_primary_key :another_id
undef_method :id
end
Could that cause any troubles?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.