Hi everyone! Sorry for the inactivity over the past few months... I am currently working on my next tutorial as I write this. I am going to be building a little Star Wars app with Express.js. Can't wait to start posting more content :D
great stuff. i think its great you took the time to style the checklist. Quick question. How could we style the forms focus state to get rid of that hideous yellow? Also how did you know to use user_signed_in? or current_user.present? etc. in the if statements? Thanks a bunch for making these videos. And I especially enjoy how you provide such detailed explanations from start to finish. It helps. And again, great stuff!
Hello and thank you for your brilliant tutorial! I have a question, why in path 'layouts/static_landing_page' we use 'static_landing_page' but to the name of the actual file we need to add underline before _static?
One more thing, if you go to localhost:3000/items/id(replace id with the number of the item) you can view other users items. And if you go to localhost:3000/items/id/edit you can edit other users items. So to prevent other users from seeing other users items you can create a private method on your items controller like this def own_item unless current_user == @item.user flash[:alert] = "You cannot view this item." redirect_to root_path end end And below the before action add another before action like this - before_action :own_item, only: [:show, :edit, :update, :destroy] This will prevent users from accessing each others items.
I wish I could understand about the comment posted by supbrotv. Due to it, please create additional video regarding the comment posted by supbrotv. Thanks.
@@LiaAdzumi When you login you can literally edit other user's todo's list. You should only be able to edit YOUR OWN todo list. Therefore you need a method in the items controller that makes sure you could only edit YOUR OWN items.
Awesome tutorial! You explained some points that some others tutorials don't explain, thanks. Now I would like to undo the "complete" action. Where can I start?
+Ryan Hemrick please help. I followed your tutorial but at the end I can only show and edit items that are marked as completed but not the new items? :(
Hello guys I just finish this tutorial; I have a sugestion about complete method def complete @item = Item.find(params[:id]) if @item.completed_at == nil @item.update_attribute(:completed_at, Time.now) else @item.update_attribute(:completed_at, nil) end redirect_to root_path end if you will change the complete methods with this. You can change the to do situation uncoplete and complete with on click.
for some reason the delete 29:32 isn't working it just refreshes the item and won't give me the warning message. i've retyped it load of times just incase. the rake routes is working. and edit/update etc. works fine. any ideas?
same here, and also functionality of Mark Complete does not have a route...this is a mixup of links used for these actions. Trying to find out what is happening as we speak. Did you come up with a solution for your problem?
Hello ryan, what is the difference between current_user.present? and user_signed_in?. I swapped current_user.present? and user_signed_in? and it didnt seem to make any difference. Can you explain this please.
+supbrotv Hi! Sorry for the late response, but ' user_signed_in? ' is a helper that is built into devise (the gem we used for authentication) and ' .present? ' is something that is in the base Ruby language. I am not sure if .present? would work in this case because I haven't tried it :D
+Ryan Hemrick, When making the the index.html.erb View file, Ruby gives an error instead of an Black Page: Sass::SyntaxError in Items#index Showing /Users/.../Ruby/Checklist/app/views/layouts/application.html.erb where line #5 raised: File to import not found or unreadable: bootstrap-sprockets. Load paths: /.../Ruby/Checklist/app/assets/images /.../Ruby/Checklist/app/assets/javascripts /.../Ruby/Checklist/app/assets/stylesheets /.../Checklist/vendor/assets/javascripts /.../Checklist/vendor/assets/stylesheets /Library/Ruby/Gems/2.0.0/gems/turbolinks-2.5.3/lib/assets/javascripts /Library/Ruby/Gems/2.0.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts /Library/Ruby/Gems/2.0.0/gems/coffee-rails-4.1.1/lib/assets/javascripts Extracted source (around line #17): */ @import "bootstrap-sprockets"; @import "bootstrap";
+Gerardo J. Colina Q. Hi Gerardo! The CSS generates a padding-top for the entire checklist item. The nth-child(n+1) is used so that the first checklist item does not have that padding. The .item class is a wrapper for the item title, description, timestamp, and icons. Hope this helps :D
+Xinke Li Hi Xinke! To learn the basics of Ruby on Rails I mainly used Michael Hartl's Ruby on Rails free tutorial. He walks through the ins-and-outs of the framework and walks through the process of building various applications. After reading through that, I just forced myself to jump in and make an app. Google and Stack Overflow are your best friends when starting out. Don't feel like you need to know everything before starting your first basic app. You will learn more by trying new things!
hey Chatz, just wondering if you did ever find a solution for the deleting issue?. i am having the same problem, everytime i try to delete the item, it just refreshes the page instead.
Clicking on the complete button for the second time makes the time reset.. the url_path should be removed from completed items, to ensure no re-submitting
Hello.. Great tutorial!! I am following this great tutorial but unfortunately, the delete function does not work. this is the code related to delete function. could you take a look? in show.html.erb in items controller def destroy @item.destroy redirect_to root_path end
Ryan, I know its been 2 years since you made this but I learning so much from this. Please keep doing more Rails projects!!
thank you very much from Morocco I learned the basics of RoR from you
I'm 45 mins in and this still works on Rails 6 in 2021!
dude this is the best tutorial of rails yet
Hi, I am from Chile and like all your tutorials.
***** Thank you man! That means a lot!
Great tutorial! As somebody who is just starting out with ruby and ror, this is very helpful!
thanks, I learnt Devise, bootstrap and simple_form
Hi everyone! Sorry for the inactivity over the past few months... I am currently working on my next tutorial as I write this. I am going to be building a little Star Wars app with Express.js. Can't wait to start posting more content :D
+Ryan Hemrick I need more rails content! Although the express.js stuff is cool too. Your tutorials are the best. :)
+Nick Taylor Yeah man, more Rails content :) +Ryan Hemrick
Excellent one I've checking over. Hoping for new Rails tutorial. Thanks.
As we say here in Brazil, "You're the guy".
Thanks for share knowledge!
See ya.
Thanks for this one, Ryan. I learned a lot. Cheers.
Great job its working sir Thank you so much for sharing this
veyr nice. you should make some more Rails tutorials, this video was really nice! =)
great stuff. i think its great you took the time to style the checklist. Quick question. How could we style the forms focus state to get rid of that hideous yellow? Also how did you know to use user_signed_in? or current_user.present? etc. in the if statements? Thanks a bunch for making these videos. And I especially enjoy how you provide such detailed explanations from start to finish. It helps. And again, great stuff!
Hello and thank you for your brilliant tutorial!
I have a question, why in path 'layouts/static_landing_page' we use 'static_landing_page' but to the name of the actual file we need to add underline before _static?
One more thing, if you go to localhost:3000/items/id(replace id with the number of the item) you can view other users items. And if you go to localhost:3000/items/id/edit you can edit other users items. So to prevent other users from seeing other users items you can create a private method on your items controller like this
def own_item
unless current_user == @item.user
flash[:alert] = "You cannot view this item."
redirect_to root_path
end
end
And below the before action add another before action like this -
before_action :own_item, only: [:show, :edit, :update, :destroy]
This will prevent users from accessing each others items.
+supbrotv Great catch! Thank youu!
I wish I could understand about the comment posted by supbrotv. Due to it, please create additional video regarding the comment posted by supbrotv. Thanks.
Another solution would be to add the following to the beginning of the items_controller.rb file:
before_action :authenticate_user!
@@LiaAdzumi When you login you can literally edit other user's todo's list. You should only be able to edit YOUR OWN todo list. Therefore you need a method in the items controller that makes sure you could only edit YOUR OWN items.
Awesome tutorial! You explained some points that some others tutorials don't explain, thanks. Now I would like to undo the "complete" action. Where can I start?
Nice work.
Gabriel Martinez Thank you!
Cool! Thanks!
Why do only the GET methods get prefixes like edit_item_path? Why is there no destroy_item_path?
+Ryan Hemrick please help. I followed your tutorial but at the end I can only show and edit items that are marked as completed but not the new items? :(
Hello guys I just finish this tutorial; I have a sugestion about complete method
def complete
@item = Item.find(params[:id])
if @item.completed_at == nil
@item.update_attribute(:completed_at, Time.now)
else
@item.update_attribute(:completed_at, nil)
end
redirect_to root_path
end
if you will change the complete methods with this. You can change the to do situation uncoplete and complete with on click.
for some reason the delete 29:32 isn't working it just refreshes the item and won't give me the warning message. i've retyped it load of times just incase. the rake routes is working. and edit/update etc. works fine.
any ideas?
same here, and also functionality of Mark Complete does not have a route...this is a mixup of links used for these actions. Trying to find out what is happening as we speak. Did you come up with a solution for your problem?
Hey, Ryan I get this error message:
Sass::SyntaxError in Items#index
Hello ryan, what is the difference between current_user.present? and user_signed_in?. I swapped current_user.present? and user_signed_in? and it didnt seem to make any difference. Can you explain this please.
+supbrotv Hi! Sorry for the late response, but ' user_signed_in? ' is a helper that is built into devise (the gem we used for authentication) and ' .present? ' is something that is in the base Ruby language. I am not sure if .present? would work in this case because I haven't tried it :D
+Ryan Hemrick, When making the the index.html.erb View file, Ruby gives an error instead of an Black Page:
Sass::SyntaxError in Items#index
Showing /Users/.../Ruby/Checklist/app/views/layouts/application.html.erb where line #5 raised:
File to import not found or unreadable: bootstrap-sprockets.
Load paths:
/.../Ruby/Checklist/app/assets/images
/.../Ruby/Checklist/app/assets/javascripts
/.../Ruby/Checklist/app/assets/stylesheets
/.../Checklist/vendor/assets/javascripts
/.../Checklist/vendor/assets/stylesheets
/Library/Ruby/Gems/2.0.0/gems/turbolinks-2.5.3/lib/assets/javascripts
/Library/Ruby/Gems/2.0.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts
/Library/Ruby/Gems/2.0.0/gems/coffee-rails-4.1.1/lib/assets/javascripts
Extracted source (around line #17):
*/
@import "bootstrap-sprockets";
@import "bootstrap";
+Dax Rahusen i also had this problem but what i did i reset my app and tried again to put this line and it worked
restart server
can you please help me understand what this line do in the css : .item:nth-child(n+1){
padding-top: 1.5em;
}
+Gerardo J. Colina Q. Hi Gerardo! The CSS generates a padding-top for the entire checklist item. The nth-child(n+1) is used so that the first checklist item does not have that padding. The .item class is a wrapper for the item title, description, timestamp, and icons. Hope this helps :D
Thanks for your help Ryan , can I have your email to send you a screenshot of the project?
Thanks for uploading these videos.
You are the Papu de los Papus
Ryan, may I ask what resources did u use to learn Ruby on Rails?
+Xinke Li Hi Xinke! To learn the basics of Ruby on Rails I mainly used Michael Hartl's Ruby on Rails free tutorial. He walks through the ins-and-outs of the framework and walks through the process of building various applications. After reading through that, I just forced myself to jump in and make an app. Google and Stack Overflow are your best friends when starting out. Don't feel like you need to know everything before starting your first basic app. You will learn more by trying new things!
+Ryan Hemrick agree :)
devise_scope :user do
get '/users/sign_out' => 'devise/sessions#destroy'
end
add the above to the Routes.rb file when Sign Out results to error
hey Chatz, just wondering if you did ever find a solution for the deleting issue?. i am having the same problem, everytime i try to delete the item, it just refreshes the page instead.
Clicking on the complete button for the second time makes the time reset.. the url_path should be removed from completed items, to ensure no re-submitting
+George James Thank you George! This was one of my first applications that I built, sorry for not catching that one!
Ryan Hemrick First app?! wow! that is cool... its great
Hello..
Great tutorial!!
I am following this great tutorial but unfortunately, the delete function does not work.
this is the code related to delete function. could you take a look?
in show.html.erb
in items controller
def destroy
@item.destroy
redirect_to root_path
end
Anyone know the theme used for sublime?
i think this is atom not sublime
2:55. Repo for the theme if anyone's interested github.com/itsthatguy/theme-itg-flat
Sorry. it looked as atom to me
Dimitar Dimitrov no worries it does look like an atom theme.
Please Sir, Can I have some more?
canu u make tutorial for absolutly beginners ?
+Adam Małysz This is 'rails g scaffold item title:string description:text' from scratch , it is worth to learn for beginner
bro i stuck on link_to "sign out" there is error....and routes didn't find....help me