Ask A Question

Notifications

You’re not receiving notifications from this thread.

The Params Hash | GoRails

Chris Oliver asked in General

Nice video - thanks. Request for future episode: part 2 on params, explaining stuff like:

params.require(:blog).permit(:title, :body)

How that all works, what Rails does when required params are missing, or not permitted params are passed through etc.

Reply

Definitely an episode on strong_params in the works. This is a great one to go in depth on.

Reply

It would be better to use larger font size in vim/macvim/terminal when recording a screencast.

Reply

Already on it! :)

Reply

Great primer - would love to see you upack this more vis a vis strong params.

Reply
Pablo Saucedo Pablo Saucedo

Ah, Thank you for this video! Just started with rails, and this was just great. I'll continue to watch the rest :)

Reply

Wow, this was a really helpful screen cast. Thanks!

Reply

Great explanation. I learned a lot and many things has become clear but I still don't understand how rails app knows if it is a Post or a Get or other URL. And other thing which is still not clear is what is "form tag blog_path" and why is it blog_path and even why do we need it at all.

Reply

Really good question and one I am going to cover in more depth in some future episodes. Basically blog_path is a Ruby method that returns a URL from your routes file. The path it returns looks like "/blog". The reason you need that is that when you submit a form, you need to pass it a URL that accepts the form data so it can save it to the database. Usually that's a specific url dedicated to just saving data. For example, if you open up the HTML on the login form on GoRails, you'll see that it points to /users/sign_in as the action which knows how to take your username and password, validate it, and sign you in:

<form class="new_user" id="new_user" action="/users/sign_in" accept-charset="UTF-8" method="post">

Reply

Nice one! Its really simple now, like you said.

Reply

Yes! Thank you for this. I have a lack of knowledge in how certain aspects of rails works. This was one part I didn't understand and now it clicked. If I don't know how important things work, I just can't progress and I feel like i'm stuck. I feel most tutorials gloss over this completely and after watching this and going over the rails docs, I actually understand how it works. Thanks Again!

Reply

You're welcome! Let me know if you have any suggestions on other topics like this you'd like to hear explained. it's easy for me to take these things for granted these days so ideas for topics are always welcome!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.