Skip to content
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

[WIP] User authentication tutorial - ROM, Rails, Warden #177

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

janjiss
Copy link
Collaborator

@janjiss janjiss commented Nov 10, 2016

No description provided.

@janjiss janjiss changed the title Usear authentication tutorial - ROM, Rails, Warden User authentication tutorial - ROM, Rails, Warden Nov 10, 2016
@janjiss janjiss changed the title User authentication tutorial - ROM, Rails, Warden [WIP] User authentication tutorial - ROM, Rails, Warden Nov 10, 2016
# <= migration file created db/migrate/20161109173831_create_users.rb
```

Let's open up our migration file and add the following lines:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you gotta add an empty line here, for some reason middleman doesn't render html correctly without it

# <= db:migrate executed
```

Once that is done, we can start working on our repositories and rom components. Let's add schema file first:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well, and in all other places, basically there must always be an empty line between a line of text and code block syntax

Copy link
Collaborator Author

@janjiss janjiss Nov 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed this one. Should be fixed

end
```

After this, we will need to add ROM rake tasks in our Procfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Procfile => Rakefile :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:trollface:


```ruby
# app/repos/users_repo.rb
include BCrypt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you replace this with require "bcrypt/password" and use fully qualified BCrypt::Password later on?

@solnic
Copy link
Member

solnic commented Nov 11, 2016

So this is really nice, but I'd like to figure out how to avoid ROM.env somehow without adding dry-container/auto_inject setup. Maybe just a MyApp.rom and MyApp.user_repo with memoization, just for the sake of encapsulation. Mentioning dry-container would be good too, maybe in some "Remarks" section at the bottom of the tutorial (there are more things we could mention there, just for clarity and better guidance, but I'll get to that tomorrow :)).

@janjiss
Copy link
Collaborator Author

janjiss commented Nov 11, 2016

@solnic Yeah, I think that is true - dry-container would be great to have in this mix, because having ROM.env everywhere is not best practice. I think adding dry-validations will also help. Thoughts?

@solnic
Copy link
Member

solnic commented Nov 13, 2016

@janjiss we could try to add a dry-container/auto_inject based setup and just see if it doesn't look too overwhelming. If I had time I would really rebuild rom-rails on top of dry-system but for now we just have to stick to what we have.

Re validation, yeah having a simple schema would be a nice and gentle into to dry-validation at the same time. We could see how it looks :) (should look pretty gooood).

@janjiss
Copy link
Collaborator Author

janjiss commented Nov 14, 2016

@solnic Got it. I will write this up in next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants