-
Notifications
You must be signed in to change notification settings - Fork 26
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
Hash lookup for Inat::Obs attributes #2418
Conversation
- fixes all but taxon-related methods
Joe - I believe there is a better, more standard Railsy way to do all this, and there's an example on my PR: Define your This gives you the accessor methods without repetitive declarations, and potentially other goodies besides, like validation (although i didn't use that). You won't have to access your attributes by hash key. It makes it work like a model instance (because it is). It's a "model not backed by a db table" and it's a very convenient thing. This is what people do for form data where the are assembling attributes that may go into some other model (like an I've known about this for years but never understand quite how to use it, but now that I did, I realize how easy it is and will be using it elsewhere. Check ObservationFilter at class SearchFilter
include ActiveModel::Model
include ActiveModel::Attributes
attribute :pattern, :string |
Thanks! Which pr has an example?
Sent from Gmail Mobile
El El sáb, sept 28, 2024 a la(s) 13:58, andrew nimmo <
***@***.***> escribió:
… Joe - I believe there is a better, more standard Railsy way to do all
this, and there's an example on my PR:
Define your inat_obs as an activemodel object. This gives you the accessor
methods without repetitive declarations, and other goodies besides. You
won't have to access by hash key.
It's a "model not backed by a db table" and it's a very convenient thing.
—
Reply to this email directly, view it on GitHub
<#2418 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALDFC2IIMMHPSQ47CD7ITZY4KBHAVCNFSM6AAAAABO2TV4ICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBQHA4TGMRSG4>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
#2337 — which as of yesterday does not require any migrations to check out, so it won't mess up your local db! |
@nimmolo: TLDR: I like the idea of a model not backed by a db table, but will postpone it till after NEMF.
|
Inat::Obs
attributes.Ex:
inat_obs[:id]
instead ofinat_obs.inat_id
Inat::Obs
class length metric offense.There is no manual test.