Closed rudzainy closed 7 months ago
Should I copy how bitly does it?
Would these shortened links be a separate ActiveRecord model from the link model in Ranting currently?
Would these shortened links be a separate ActiveRecord model from the link model in Ranting currently?
Dayum that's a good question. Comparing them:
link
have many short_link
sWhen signed in users create a new link
, and create a short_link
from that new link
, the short_link
will reference the link
's url as it's long_url
.
When anonymous user creates a short_link
from a custom long_url
, well nothing else needs to be done here...
link
has a short_link
columnshort_link
from a custom long_url
, a new link
will be created with no user associated, or assigned to an anonymous or an admin or a system user account. link
and short_link
will call from the same AR model and filtered accordingly. I think it should not be separated if we want to keep things simple🤔
I also think there's much more we can explore with short link IN THE FUTURE 😂
Should I copy how bitly does it?
Just a simple one like sini.la (which uses https://github.com/YOURLS/YOURLS) 😬
Would these shortened links be a separate ActiveRecord model from the link model in Ranting currently?
Dayum that's a good question. Comparing them:
A:
link
have manyshort_link
s
- When signed in users create a new
link
, and create ashort_link
from that newlink
, theshort_link
will reference thelink
's url as it'slong_url
.- When anonymous user creates a
short_link
from a customlong_url
, well nothing else needs to be done here...B:
link
has ashort_link
column
- When anonymous user creates a
short_link
from a customlong_url
, a newlink
will be created with no user associated, or assigned to an anonymous or an admin or a system user account.- Index pages for
link
andshort_link
will call from the same AR model and filtered accordingly.I think it should not be separated if we want to keep things simple🤔
I also think there's much more we can explore with short link IN THE FUTURE 😂
I think we should go with link has_many short_links, Seems a bit more flexible for things we can explore IN THE FUTURE.
But then for anonymous_users, everytime they create a short_link it creates a new_link right?
Should I copy how bitly does it?
Just a simple one like sini.la (which uses https://github.com/YOURLS/YOURLS) 😬
Actually for existing links, shouldn't it just be a button? Then we will create a short_link associated with it?
But then for anonymous_users, everytime they create a short_link it creates a new_link right?
Yes. This is one drawback i don't prefer. Do u think it will add too many unnecessary complexity?
An alternative is to add a column in short_url
called something like long_url
...
Yes. This is one drawback i don't prefer. Do u think it will add too many unnecessary complexity?
I think if its going to be one off links it should be fine. Each anonymous user short link will need their own special link anyway if they want to view basic statistics
TODO
Link model
belongs_to user :optional
Create page for short_link
Track usage
TO DON'T
Update on ShortLink model
create_table :short_links do |t|
t.references :links <-- original url lives here
t.string :statistics_token <--- token to take user to the statistics page
t.string :url_token <--- token to add on to our shortener domain eg. suri.li/:url_token
t.timestamps
end
www.ranting.my/s/token
for nowcreate short link
button.@rudzainy Can close?
Will close after i'm done with the UI 🥶
@hewrin seems like all short links has a =
at the end. do you know why? 🤔
Done with #88