atlas icon indicating copy to clipboard operation
atlas copied to clipboard

Make autogenerated finders overridable (Skip def using Module.defines? before compile)

Open chrismccord opened this issue 10 years ago • 4 comments

chrismccord avatar Aug 20 '13 04:08 chrismccord

Is this regarding the with_field_name finders? https://github.com/chrismccord/atlas/blob/master/lib/atlas/finders.ex#L30

What if we removed those in favor of a find_by/1 which takes a keyword list like ActiveRecord 4?

User.find_by(username: "bob", password: "secret")

scrogson avatar Jun 05 '14 18:06 scrogson

Yes, :+1: on the removal. We want to make sure only valid keys are passed.

chrismccord avatar Jun 05 '14 18:06 chrismccord

ie, we should raise something like Schema.UndefinedFieldError if a passed key does not map to the defined schema

chrismccord avatar Jun 05 '14 19:06 chrismccord

gotcha.

scrogson avatar Jun 05 '14 20:06 scrogson