You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine you have 2 models (city and country) with nested attributes feature, then the model country has n cities,
the principal validation is that a for each record, the language is unique
Steps:
create unique index
rails g migration AddIndexToCity
I have been using the devise gem with rails to implement user authentication for may applications.
When implementing authentication though API requests, then I turn to the devise-jwt gem.
I faced an issue when implementing refresh tokens with devise, as devise does not support access tokens.
I still needed the superior authentication that devise provides, but needed to manually work with fresh tokens.
After looking around the web, here is how I was able to modify the code to implement refresh tokens with devise-jwt.
Take for the example a user model to sore the user email and password.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I recently spent some time dealing with nested forms in Phoenix. Nested forms are great when you want to create multiple database records in a single transaction and associate them with each other. I am new to Phoenix and really struggled to find any resources that helped me with my specific problem. I decided to document what I learned in the process in hopes of helping others that are new to Elixir and Phoenix.
Here is my attempt at a one stop shop to learn everything you will need to know about nested forms. If you would like to view the GitHub repo you can check it out here.
Thanks to Heartbeat and Jose for excellent blog posts on nested forms. Also shoutout to Josh for showing me some examples at Ruby
This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app.
The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly
and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)