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
Draft: Add Tags #714
Draft: Add Tags #714
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the PR here, as I mentioned in the Discussion, I definitely think tags are a must-have for the system.
We don't have any internal designs for this quite yet, so I think in order to introduce this, it would have to be backend only for the moment.
If you wanted to go down that route, I'd probably favor a many to many relationship as ActiveRecord has a lot of neat helpers and handles this quite well.
I will get a design iteration going internally shortly so that we can get this added.
@@ -23,6 +23,14 @@ class Transaction < ApplicationRecord | |||
.where("er.rate IS NOT NULL OR transactions.currency = ?", currency) | |||
} | |||
|
|||
def tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Rails, since you've set tag_ids
as a column on the model, you wouldn't need this explicit getter and setter unless you wanted to perform some sort of modification prior to saving
@@ -82,7 +82,11 @@ def sync | |||
private | |||
|
|||
def set_account | |||
@account = Current.family.accounts.find(params[:id]) | |||
begin | |||
@account = Current.family.accounts.find(params[:id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Rails this error handling is typically not necessary as the @account
would just be nil
if not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was actually a fix for something else. If you navigate to an account_id
that doesn't exist, rails spits out stack traces which is not very graceful.
@flacnut going to close this out for now and we can re-open it (or open a new one) when we get the designs for it. We've been doing some roadmap planning and will definitely be getting this in soon! |
I am not familiar with Ruby or Rails, constructive feedback welcomed!
This PR is a draft of possible ways to add tags.
Context (713)
I have in the past used the ORM / ActiveRecord completely, mapping a many-to-many with a join table, however this negatively impacted the performance of my application for the use case of generating many charts which include tag filters.