TheOdinProject / curriculum

The open curriculum for learning web development
https://www.theodinproject.com/
Other
9.99k stars 13.35k forks source link

Sessions Cookies and Authentication: Wrong information #26801

Closed PaulooMartin closed 10 months ago

PaulooMartin commented 11 months ago

Describe your suggestion

This paragraph under Controller Filters contains incorrect / incomplete information.

The before_action method takes the symbol of the method to run before anything else gets run in the controller. If it returns false or nil, the request will not succeed.

According to this rails api for before_action, the action does not run if the callback redirects or renders something else.

I also tested this out with my members-only app, the information from TOP did not match the result I got. The result I got was similar to the rails-api or rails-guides.

Path

Ruby / Rails

Lesson Url

https://www.theodinproject.com/lessons/ruby-on-rails-sessions-cookies-and-authentication#controller-filters

Checks

(Optional) Discord Name

No response

(Optional) Additional Comments

No response

JoshDevHub commented 11 months ago

Yeah you're absolutely correct on this one. It should say something like

The before_action method takes the symbol of the method to run before anything else gets run in the controller. If the method uses a render or redirect, the target controller action won't execute.

Would you be interested in making this change @PaulooMartin ? If not, that's okay, we can get someone else on it.

PaulooMartin commented 11 months ago

Hey @JoshDevHub, thanks for getting back at this.

Unfortunately, I am too busy these times so I wouldn't be able to take the time to make the change.

JoshDevHub commented 11 months ago

No problem. Thanks for spotting this issue in the curriculum @PaulooMartin :raised_hands:

stxss commented 10 months ago

Hey! I'm available to contribute to this issue!

While at it, I propose the addition of hyperlinks to the docs on occurrences of this sort, so the student can actually go directly to the documentation instead of blindly accepting what is said as truth. Or it would be better, in your opinion, that we encourage independent look-up of the said documentation?

JoshDevHub commented 10 months ago

Thank you for volunteering @stxss

I think we can go without a link to the docs. There's already a link to the Rails guides content on controller filters in the assignment at the end of the lesson. So learners should eventually read this from the documentation anyway.