For anyone using rails 6, the update_attributes function is deprecated. It is simply article.update(article_params). Great Video either way but wished there was some installation guide, as a beginner it took me a long time trying to gem install mysql2.
Thanks for this! I had the same issue on Mac. I had to install MySQL first using homebrew before it would work. In any case, this was a great tutorial so thanks for taking the time to make it :)
You are an absolute blessing, I was going thru your Laravel tutorial on Udemy and then I was thinking of a scenario and wanted to know how to expose a REST api thru rails, I googled and then heard a familiar voice and there you are again lol. Thank you for doing what you do, and I took your Bootstrap 4 course as well which significantly made me better at UI.
Been out of Rails development for a few years now. I've not looked back because I DETEST full-stack development. By that, I mean I really dislike having to figure out what "flavor of the week" technologies someone has implemented and research them. For this reason I've not accepted any LinkedIn offers. A college classmate suggested I revisit Rails and specifically specialize in APIs. Landed me here. Great tutorial! I especially liked the impromptu nature. (Complete with cussing.) Thanks so much!
Wonderful, thank you Brad. Six years later works well. Just one change: update_attributes is already been deprecated, use update instead.
5 ปีที่แล้ว
I followed tonight this tutorial without any problems. I have already used Postman before but with you explaining it looks like easier. Nowadays the Postman Extension is deprecated as Google Web Store shows in its page and they suggest us to use Postman Native Apps, but even this way it worked perfectly here. Thanks again for sharing your experience with us, Brad. :)
You managed to cover what took my instructor almost 4 hours to cover in 1 hour. and it is so clear and easy to follow. thank you so much for making this.
I have been watching your videos for like a year and you inspired me to learn to program. I'm a rails developer now and I literally never know what the hell you looked like. Hahaha, thanks so much for being awesome. Keep up the good work. You have become my after work podcast on my way home. :)
Yeah, but it's the nerd looking people who normally put the most work & time into it, computing if you really want to be good you have to sacrifice many things. Also love books & documentation, people forget there's already been over 70 years of knowledge build up and that takes a long time to catch up to, I see too many trying to do shortcuts and rely too heavily on frameworks and libraries. Frameworks came to be because people who knew how to do from scratch wished to make development quicker, but now people only know how to use frameworks without understanding the core structure itself.
You can still care about what you look like, dress nice, go to the gym, etc and have huge passion for programming (or anything else). I have nothing against the people you are talking about, the nerdy types that basically do nothing else but I love diversity and I love to show people that anyone can do this if you have the passion for it, doesn't matter what you dress like, look like, music you like or anything else.
I wasn't saying you couldn't, I was just added the reason why a certain type of person seems to be so prevalent within the industry as I try to get really in-depth into computing knowing it from all angles from both low and high even I find it hard to allocate time for other things hence why I said sacrifice is quite often demanded, if you want to reach the zenith of your field, whether that be web, gaming, desktop, network and so on. Quite frankly the more I delve deeper into the rabbit hole it gets even more overwhelming, so I understand why people stop caring about the more normal day to day activities, luckily enough I enjoy computing immensely, but I do understand why many drop off, I now also tell people don't get into it, if you are just trying to make money, only if you truly interested. Anyway nice video.
Yes! That is what many people that a re just starting out do not understand. They ask how I know so many frameworks, but there is just so much that is similar. If you know migrations in Laravel you know them in Rails. Just minor syntax differences. There are so many things like that
I bought your course by building 12 applications with Angular 2 and it's amazing, and all the videos you've done on youtube have been the same, I've learned too much! THANK YOU! I'll wait for the authentication token! (Part 2 of this video haha) thanks! : P
Nope, I have not given up on anything :) Well may be Flash lol. I want to have resources for all languages/frameworks. Rails is just a little more time consuming in my experience. I still plan on doing a shopping cart at some point
Great starting tutorial, it got me going in the right direction. I did hit a wall attempting to connect to a pre-existing database and not a newly created one. RoR has this funny opinion about lower case table names and pluralizing things by default so that took me a while to figure out. But now I'm off to the races. Thanks!
Thanks so much for making this tutorial - I'm still a student now but I'll make sure to show my support once I have a full time job - many thanks again!
Great video, Brad! After this, now learning how to add authentication to the API using Devise and JWT. Wouldn't advance without this video! Thanks a lot!
If you get "ActionController::InvalidAuthenticityToken" error you can add skip_before_filter :verify_authenticity_token to application_controller.rb to make it work
Anyone who gets an error at 29:00 put this line at the top of the controller (before the index,show and create but inside the class): skip_before_action :verify_authenticity_token
Actually if you want to be safe, you should include your authenticity token in you post requests. Just adds another layer of security. You solution is not checking the authenticity at all meaning anyone can post to it.
I like your style Brad. Thanks for this tutorial it was very well done and easy to understand. I really like the pace and explanation on your tutorials. Thanks
Great article - thank you Traversy. One small bug in the controller destroy method. It should follow the same pattern to be safe: if article.save ... else ... end
If you are using a recent version or RoR and get the error `undefined method update_attributes` for the update functionality, replace the `update_attributes` with just `update`
I have to learn Ruby and RoR for work so I can work on some of the microservices there. Since I don't want to invest a huge amount of time learning Ruby for my own personal reasons/opinions, this course is perfect. Wondering if we can get an updated 2022 version?
(Rails5.0.6) For people who can't get Postman to cooperate at @23:00 add Rails.application.routes.draw do get "api/v1/articles" => "api/v1/articles#index" You need specifically tell Rails to get that route and from where
Actually, what helped me a lot was a code from this website: backend.turing.io/module3/lessons/building_an_api # config/routes.rb namespace :api do namespace :v1 do resources :articles, only: [:index] end end
Hey there! I didn't know where to post this request so here we go. I was wondering if you could do some tutorials on GraphQL and how to use it as a starting point for s ingle feature in RoR App...say a blog post, or an article. THANKS! I'm getting super into GraphQL and want to know how to kick off architecting Apps and API's with it in mind.
Thanks for the video, I've learn a lot. Have on question, when doing a get request, how can you find by the title of the article and not by the ID? Sorry if my question is dumb, I'm newbie and learning. Thanks!
This is really great! One question, however: on top of this API, could you still build the rails application as normal? Like could I have a full web app with bootstrap, and user auth, and all the functionality I need AND the API on one website? or will I have to make this rails API, and in addition to it, make another rails project which only consists of the application itself?
Brad my man, Im kinda new to programing and Im already learning Rails, a lot of people told me that its the best way to learn back end. What do you think? Awesome job man, please keep keep going :)
I think it is a good choice. It is very clean compared to something like PHP but all languages/frameworks have pros and cons. Node.js/Python/Ruby on Rails/PHP all good choices, it is all preference.
Thx a lot man! I´m going to keep learning Rails and later start with the JavaScript thing. I'm still very glad to see your React and other JS videos, to make me the best idea of everything that its going on.
Traversy, I have a question about Rails 5. I'm currently using a virtual environment "vagrant", I have rails 4 installed on there. How do I build a rails 5 app without replacing my rails 4? Sorry if this is an easy question, still new to all this.
An error occurs in the beginning and i am not able to go further "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found."
Nice tutorial, although I don't see any reason to use a database server during development. SQLite is more than fast enough for that, and using MySQL makes it a hassle to set up CI, and makes it harder for any new contributors to get set up as they have to set up a DB server and change the username/password.
if u just add it to the Gemfile and then do bundle in terminal, it automatically installs it locally so, that u don't have to manually install it again.
I get the following response to the POST method in 28:00 even though my body isn't blank: {"status":"ERROR","message":"Article not saved","data":{"title":["can't be blank"],"body":["can't be blank"]}} Anyone can help?
Hi Brad. I have question about learning. I am building wordpress websites and selling on market. Also i want to learn vue.js Python etc.. Do you should to learn some languages or frameworks when building something ?
the 'rails s' command isn't working for me, it's saying that "Could not find gem 'tzinfo-data x86-mingw32' in any of the gem sources listed in your Gemfile." I followed all your steps
Hi Brad, is it possible to download the videos after I buy the 10 projects course on eduonix? I don't have unlimited internet at home but I was planning on downloading the videos at work and do the projects at home.
Honestly I have no idea. The courses I make for them I have no control over and have no say in. I am paid a fixed price and they handle the rest. I would suggest emailing support
what is the difference between this approach and just using regular rails g resource that generates jbuilder templates as well ( which spits json ) I am little confused .
If you use a command like 'rails g articles' -> it will modify the routes file, it will perform the migration, it will create a users controller and it will also create some test files. The method used in the video is more manual as you can see. But allows you to not create the unnecessary files.
It's a joy to see that people are still learning rails. Beautiful framework for beautiful language!
It's a relic of the past. A good one, but still a relic.
For anyone using rails 6, the update_attributes function is deprecated. It is simply article.update(article_params). Great Video either way but wished there was some installation guide, as a beginner it took me a long time trying to gem install mysql2.
Thanks for this! I had the same issue on Mac. I had to install MySQL first using homebrew before it would work.
In any case, this was a great tutorial so thanks for taking the time to make it :)
You are an absolute blessing, I was going thru your Laravel tutorial on Udemy and then I was thinking of a scenario and wanted to know how to expose a REST api thru rails, I googled and then heard a familiar voice and there you are again lol. Thank you for doing what you do, and I took your Bootstrap 4 course as well which significantly made me better at UI.
Been out of Rails development for a few years now. I've not looked back because I DETEST full-stack development. By that, I mean I really dislike having to figure out what "flavor of the week" technologies someone has implemented and research them. For this reason I've not accepted any LinkedIn offers. A college classmate suggested I revisit Rails and specifically specialize in APIs. Landed me here. Great tutorial! I especially liked the impromptu nature. (Complete with cussing.) Thanks so much!
Wonderful, thank you Brad. Six years later works well. Just one change: update_attributes is already been deprecated, use update instead.
I followed tonight this tutorial without any problems. I have already used Postman before but with you explaining it looks like easier. Nowadays the Postman Extension is deprecated as Google Web Store shows in its page and they suggest us to use Postman Native Apps, but even this way it worked perfectly here. Thanks again for sharing your experience with us, Brad. :)
You managed to cover what took my instructor almost 4 hours to cover in 1 hour. and it is so clear and easy to follow. thank you so much for making this.
I have been watching your videos for like a year and you inspired me to learn to program. I'm a rails developer now and I literally never know what the hell you looked like. Hahaha, thanks so much for being awesome. Keep up the good work. You have become my after work podcast on my way home. :)
You are an inspiration to me showing you don't have to be a nerd looking guy with glasses and mess hair to be a programmer I love it :)
Thanks. Yeah screw stereotypes. I can't stand them. I do have glasses by the way, my eyes are horrible but I wear contacts :)
Yeah, but it's the nerd looking people who normally put the most work & time into it, computing if you really want to be good you have to sacrifice many things.
Also love books & documentation, people forget there's already been over 70 years of knowledge build up and that takes a long time to catch up to, I see too many trying to do shortcuts and rely too heavily on frameworks and libraries.
Frameworks came to be because people who knew how to do from scratch wished to make development quicker, but now people only know how to use frameworks without understanding the core structure itself.
You can still care about what you look like, dress nice, go to the gym, etc and have huge passion for programming (or anything else). I have nothing against the people you are talking about, the nerdy types that basically do nothing else but I love diversity and I love to show people that anyone can do this if you have the passion for it, doesn't matter what you dress like, look like, music you like or anything else.
I wasn't saying you couldn't, I was just added the reason why a certain type of person seems to be so prevalent within the industry as I try to get really in-depth into computing knowing it from all angles from both low and high even I find it hard to allocate time for other things hence why I said sacrifice is quite often demanded, if you want to reach the zenith of your field, whether that be web, gaming, desktop, network and so on.
Quite frankly the more I delve deeper into the rabbit hole it gets even more overwhelming, so I understand why people stop caring about the more normal day to day activities, luckily enough I enjoy computing immensely, but I do understand why many drop off, I now also tell people don't get into it, if you are just trying to make money, only if you truly interested.
Anyway nice video.
Damn you rock man.Am a laravel guy and just realized shifting to rails can take me a week or so to grab the concepts
Yes! That is what many people that a re just starting out do not understand. They ask how I know so many frameworks, but there is just so much that is similar. If you know migrations in Laravel you know them in Rails. Just minor syntax differences. There are so many things like that
I bought your course by building 12 applications with Angular 2 and it's amazing, and all the videos you've done on youtube have been the same, I've learned too much! THANK YOU!
I'll wait for the authentication token! (Part 2 of this video haha) thanks! : P
Exactly what I needed. Great video... 4 years later and is very useful yet.... thanks
Thank you so much. Rails 5 is amazing, I'm so grateful for your tutorial.
I'm so glad that you made this video!
I thought that you gave up on Rails.
Thanks for your great videos :)
Nope, I have not given up on anything :) Well may be Flash lol. I want to have resources for all languages/frameworks. Rails is just a little more time consuming in my experience. I still plan on doing a shopping cart at some point
Traversy Media with spree or from scratch?
that “shit” at 4:40 was awesome
Great starting tutorial, it got me going in the right direction. I did hit a wall attempting to connect to a pre-existing database and not a newly created one. RoR has this funny opinion about lower case table names and pluralizing things by default so that took me a while to figure out. But now I'm off to the races. Thanks!
I cant thank you enough, with this video I know exactly what I have to do for a test
Recommended Ruby on Rails REST-API tutorial 👍🏻
I'm really digging ruby right now: just wish it was more popular these days.
oh yeah
It is valid to notice that at 18:39, the @articles could be something like: Article.order(created_at: :desc).
Another great tutorial. You take the great factor of of learning a new language.
Nice tutorial. CRUD API in 30 mins is pretty awesome.
Thanks
Very clear presentation about Ruby on Rails API functionality. Thank you about contribution.
Thanks so much for making this tutorial - I'm still a student now but I'll make sure to show my support once I have a full time job - many thanks again!
Great video, Brad! After this, now learning how to add authentication to the API using Devise and JWT. Wouldn't advance without this video! Thanks a lot!
Great video man. Much better than all the other tutorials on rails APIs
Awesome thanks for posting this, Rails APIs are the easiest to make in the industry, even easier than Express IMO.
Love starting up youtube and seeing new great content. Keep up the great work.
Fantastic video man! Thank you very much. Your channel has been and continues to be extremely helpful. Keep up the great work!
If you get "ActionController::InvalidAuthenticityToken" error you can add
skip_before_filter :verify_authenticity_token
to application_controller.rb to make it work
skip_before_action :verify_authenticity_token
Big fan sir of your teaching style
Anyone who gets an error at 29:00 put this line at the top of the controller (before the index,show and create but inside the class): skip_before_action :verify_authenticity_token
This one didn't help me, but adding :create into routes.rb after :index and :show works perfectly
it didnt work ;< so confusing
Actually if you want to be safe, you should include your authenticity token in you post requests. Just adds another layer of security. You solution is not checking the authenticity at all meaning anyone can post to it.
Definitely donating for great content!
Thank you for uploading a ror project again!
Thanks good resource for beginers to understand REST Api
Great simple tutorial. Thanks! And it's so awesome to be running Rails on Windows now finally!!!
I like your style Brad. Thanks for this tutorial it was very well done and easy to understand. I really like the pace and explanation on your tutorials. Thanks
Great article - thank you Traversy. One small bug in the controller destroy method. It should follow the same pattern to be safe: if article.save ... else ... end
Thanks,Can you make video on user authentication API
Awesome. Simple and easy to understand.
If you are using a recent version or RoR and get the error `undefined method update_attributes` for the update functionality, replace the `update_attributes` with just `update`
That was awesome you're the best it's even easier than rest Api in Flask 😎😎😎
I have to learn Ruby and RoR for work so I can work on some of the microservices there. Since I don't want to invest a huge amount of time learning Ruby for my own personal reasons/opinions, this course is perfect. Wondering if we can get an updated 2022 version?
So simple. So clear. So good. Thank you so much.
Вы спасли мою курсовую работу! Thanx a lot!
Great tutorial, easy to follow and well explained. Thank you!!
You can also use Hyper Terminal with bash in Windows. I prefer it over the Git bash because Hyper is very customizable.
Awesome tutorial! I got a lot of things...thank you!
Thank you very much. All good, all functional and with spanish words where is applicable. Greet for Chile.
What do you use for formatting the code, I noticed that your code gets auto formatted on save.
hi thanks for video can you make a video on api consumption ... from one rails appilcations to another like you did here with postman
(Rails5.0.6) For people who can't get Postman to cooperate at @23:00 add
Rails.application.routes.draw do
get "api/v1/articles" => "api/v1/articles#index"
You need specifically tell Rails to get that route and from where
Actually, what helped me a lot was a code from this website: backend.turing.io/module3/lessons/building_an_api
# config/routes.rb
namespace :api do
namespace :v1 do
resources :articles, only: [:index]
end
end
I thought you are a very skinny and geek looking guy :) I've been wrong for years! Thanks for another great tutorial.
I get that a lot :) Unfortunately that is how we think of programmers. I enjoy breaking stereotypes
Thank you so much! This video is really helpful and clear for a beginner like me!!
Hey there! I didn't know where to post this request so here we go. I was wondering if you could do some tutorials on GraphQL and how to use it as a starting point for s ingle feature in RoR App...say a blog post, or an article. THANKS!
I'm getting super into GraphQL and want to know how to kick off architecting Apps and API's with it in mind.
Awesome video, good edition, well explained, straight to the point.
Your videos are always helpful, thank you.
thanks for the video. possible to make another one with user Auth with devise?
I have been waiting for this!!
Great work requires great appreciation. Thanks for great video, man.
You saved my day. Thank you very much 👏🏿👏🏿👏🏿👏🏿👏🏿👏🏿👏🏿
Thank you, is there another rails api with token for auth ?
From where do you got the credentials at 6:53?
Brilliant tutorial! Well explained. Thank you
undefined local variable or method `article_params' in rails version 6. I think its deprecated to do it that way
Thank you so much, Sir! More power
this was so great but i need to include a simple association in the render json and can't find a way to do it in this context :(
Fantastic video man!
Great video brad, very useful :)
Great video! It helped me out a lot!
Thanks for the video, I've learn a lot. Have on question, when doing a get request, how can you find by the title of the article and not by the ID? Sorry if my question is dumb, I'm newbie and learning. Thanks!
This is really great! One question, however: on top of this API, could you still build the rails application as normal? Like could I have a full web app with bootstrap, and user auth, and all the functionality I need AND the API on one website? or will I have to make this rails API, and in addition to it, make another rails project which only consists of the application itself?
Brad my man, Im kinda new to programing and Im already learning Rails, a lot of people told me that its the best way to learn back end. What do you think?
Awesome job man, please keep keep going :)
I think it is a good choice. It is very clean compared to something like PHP but all languages/frameworks have pros and cons. Node.js/Python/Ruby on Rails/PHP all good choices, it is all preference.
Thx a lot man! I´m going to keep learning Rails and later start with the JavaScript thing.
I'm still very glad to see your React and other JS videos, to make me the best idea of everything that its going on.
Juan Camilo Quintero best decision ever.
Ruby is cool. It paves a way for other languages, after you know ruby it is easier to learn python, crystal and elixir
Kept it real. Love it!
Could you demonstrate how to upload the blog application you have did in ruby on rails to hero ku deployment..!!!
mysql2 does not work with the latest ruby. Cannot install. Any workaround? Thanks
Thank you! that was really good and simple!
localhost/phpmyadmin is running on a different localhost port? or is it using the same port as the rails server does?
Thank you very much for the great video.This helped me a lot, please make the video on the authentication of API application
awesome! clear explanations
Traversy, I have a question about Rails 5. I'm currently using a virtual environment "vagrant", I have rails 4 installed on there. How do I build a rails 5 app without replacing my rails 4? Sorry if this is an easy question, still new to all this.
An error occurs in the beginning and i am not able to go further "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found."
awesome as always!
Nice tutorial, although I don't see any reason to use a database server during development. SQLite is more than fast enough for that, and using MySQL makes it a hassle to set up CI, and makes it harder for any new contributors to get set up as they have to set up a DB server and change the username/password.
if u just add it to the Gemfile and then do bundle in terminal, it automatically installs it locally so, that u don't have to manually install it again.
Dude you are a life saver. Thank you.
Exelente explicacion, justo lo que necesitaba.. Saludos
hey trad can you make a tutorial showing us how to Install a free SSL certificate with letsencrypt for a node js app?
Hey Dude! The video is awesome!! Thank you
Thank you. Awesome work!!!
I get the following response to the POST method in 28:00 even though my body isn't blank:
{"status":"ERROR","message":"Article not saved","data":{"title":["can't be blank"],"body":["can't be blank"]}}
Anyone can help?
Thank you so much! Really helpful!
Hi Brad. I have question about learning. I am building wordpress websites and selling on market. Also i want to learn vue.js Python etc.. Do you should to learn some languages or frameworks when building something ?
Amazing video! Keep it up.
the 'rails s' command isn't working for me, it's saying that "Could not find gem 'tzinfo-data x86-mingw32' in any of the gem sources listed in your Gemfile." I followed all your steps
Really really helpful, thank you
Hi Brad, is it possible to download the videos after I buy the 10 projects course on eduonix? I don't have unlimited internet at home but I was planning on downloading the videos at work and do the projects at home.
Honestly I have no idea. The courses I make for them I have no control over and have no say in. I am paid a fixed price and they handle the rest. I would suggest emailing support
okay, thanks.
if possible to show how to post a picture with rails api?
I'd take Ruby over PHP any day. Great tutorial, btw.
what is the difference between this approach and just using regular rails g resource that generates jbuilder templates as well ( which spits json )
I am little confused .
If you use a command like 'rails g articles' -> it will modify the routes file, it will perform the migration, it will create a users controller and it will also create some test files.
The method used in the video is more manual as you can see. But allows you to not create the unnecessary files.
Great Informative Video