Ruby on Rails Tutorial Part 2 - CRUD Basics with the Rails Console

  Рет қаралды 74,910

andrewperk

andrewperk

Күн бұрын

Пікірлер: 70
@DennyMueller
@DennyMueller 12 жыл бұрын
Thanks for this tutorials. Watched so many videos as ror greenhorn, but no tutorial explained the essentials as good as yours.
@victorls
@victorls 10 жыл бұрын
For those running on rails 4! The line of code that is written on 4:35 "attr_accessible :title, :content" does not work on rails 4. Instead, you have to move on to the controller and write the following: class PostsController < ApplicationController def new @p= Post.new(post_params) end private def post_params params.require(:post).permit(:title,:content) end end Solution found here: stackoverflow.com/questions/18409783/cant-mass-assign-protected-attributes-in-rails-4 Hope it helps!
@rgbm21
@rgbm21 10 жыл бұрын
You are right.I was stuck in it for a while..Thanks
@MrBrianHare
@MrBrianHare 9 жыл бұрын
Thank you
@eklektisk2231
@eklektisk2231 9 жыл бұрын
Thank you! :D
@keithchong6960
@keithchong6960 9 жыл бұрын
+Víctor Lopez THANK YOU SO MUCH DUDE I LOVE U
@andrewperk
@andrewperk 12 жыл бұрын
Hi Matt, we just use the name of the Model and in Rails the models class name has the first letter capitalized. Yes, you reference all models the same way by calling the model's name and using dot (.) notation to access its methods and properties.
@alsouno
@alsouno 12 жыл бұрын
best RoR tutorial series on youtube i've come across. thanks :)
@hellohello223
@hellohello223 10 жыл бұрын
For people who are using Rail 4, you need to install gem install protected_attributes or save gem 'protected_attributes' in the GEMFILE
@andrewperk
@andrewperk 11 жыл бұрын
Hi Scott, I never expected my videos to be as popular as they are and I just wanted to make some videos as I enjoy teaching. At the time I only had a cheap microphone and this is the quality that it gave me. Hopefully you'll still be able to learn even with the bad audio. Thanks for watching.
@imrankhanvu
@imrankhanvu 11 жыл бұрын
hello andrew perk, u know i was intrested in ror, and i was looking for a start, because from last two or months i was looking for tutorials and trainings, i was listing to some screen costs, but i was confused that whats going on, i wasn't clear that what is rails and what r they doing, and now at the end i found u on youtube, great lecture, i m pleased to found ur lectures, thanks a lot,
@annabortsova
@annabortsova 13 жыл бұрын
Great videos! so much better than reading through documentation on my own !!! thank you!
@msnazi
@msnazi 12 жыл бұрын
I'm coming from JavaScript to Ruby. This language is beautiful
@andrewperk
@andrewperk 13 жыл бұрын
@gamers542 Hello, yes it will work on windows. I used to do Rails on windows before moving to Linux. You should still be able to use almost the exact same commands. In your command line navigate into your rails app and run rails console or rails c as instructed. The reason I switched from Windows to Linux is because windows is terribly slow with Rails and testing. In Linux it's very fast. Things for rails just work in Linux where as in Windows it was always a struggle and Googlefu was needed.
@HVRain
@HVRain 13 жыл бұрын
The best RoR tutorial, thank you
@minkury
@minkury 12 жыл бұрын
You have no idea, how helpfull you are to me!!!
@inhibited44
@inhibited44 9 жыл бұрын
I programmed rails a few years ago. Never knew you could update or delete by command line. That's good to know. Rails 4 changed so much that I have to rewrite my programs to use them :(
@wilprim5383
@wilprim5383 11 жыл бұрын
I love these tuts! They have helped me a ton.
@rixterman07
@rixterman07 11 жыл бұрын
I had to use the syntax: post = Posts.new(.... i.e. plural Posts otherwise an error results... Like the videos! Starts out nice & simple...
@aaaabbbbccc123
@aaaabbbbccc123 10 жыл бұрын
Note these videos are working in Rails 3.1 hence why post.new are throwing exceptions. See stack flow link for fix: stackoverflow.com/questions/17371334/how-is-attr-accessible-used-in-rails-4
@orujgadimov4420
@orujgadimov4420 8 жыл бұрын
@andrewperk Thanks for your great help! It is very easy to follow and understand your tutorials. I have a question and I was wondering if you could help me with that. When i try -create Post table, it always says "nil" never goes to comment "Our first post" etc What am I doing wrong? Thanks beforehand for your help!
@andrewperk
@andrewperk 13 жыл бұрын
@TheBrogrammer You're welcome.
@SUNILRAHEJA
@SUNILRAHEJA 10 жыл бұрын
Thanks ....this was helpful too!! I had a issue with the attr_accessible since i was running Ruby 4. However i could figure it out through googling. :)
@sthardman
@sthardman 11 жыл бұрын
No worries. It's just so hard to focus. I skipped this one. The others are better. Thanks for posting. It's really helpful.
@sjalal0228
@sjalal0228 11 жыл бұрын
Great video...very easy to understand.
@leandro842
@leandro842 9 жыл бұрын
you are amazing man! this will help me very mutch, tank you!
@NjeriChelimo
@NjeriChelimo 12 жыл бұрын
I did find it useful. Very clear. Thanks! :D
@illtriniboy
@illtriniboy 11 жыл бұрын
I just did this too, I guess we will see how this pans out
@stcheeve
@stcheeve 10 жыл бұрын
Great tutorial vids, straight to the point. The poping and audio skipping is extremely annoying though.
@oldno7uk
@oldno7uk 11 жыл бұрын
patience of a saint!
@monarkbhagat848
@monarkbhagat848 10 жыл бұрын
Hey Andrew.. I am very new to Ruby and ROR too, I just went as per ur video, I am using Rails 4; I added Post.new() to Post Controller and also did the post = Post.New[] in console when I tried to save it as per the video in console I wrote post.save its showing NoMethodError am stuck to this and hope to have a Quick reply on it..
@fxStar
@fxStar 11 жыл бұрын
Hello, I'm getting NameError: undefined local variable or method `post' for main:Object when I try to do post.save ? Any ideas ? Thank your for these tutorials.
@gamers542
@gamers542 13 жыл бұрын
But why do the post commands from the terminal instead of running a single file that has the commands stored? Is it easier that way or just for demonstration purposes?
@BlazeX344
@BlazeX344 9 жыл бұрын
Very helpful tutorial, thanks! :)
@isnerdy
@isnerdy 11 жыл бұрын
Workaround for the runtime error: If you look at the error messages, it says that attr_accessible is depricated (AKA no longer used), and that there's a new security model for mass assignment. While probably not the best idea, one way around that is just to remove the attr_accessible line from the posts.rb file. I deleted the line and then didn't get any errors when setting up the hash.
@gamers542
@gamers542 13 жыл бұрын
I'm learning RoR some more and your vids make it easy to follow. Question though. Can you do all that in a file and do Ruby (file name).rb on the command line (I'm using Windows) and it would still work? Thanks.
@shrenikdoshi2690
@shrenikdoshi2690 9 жыл бұрын
Hey your tutorials are very helpful to me But i have encountered one error please solve it asap NoMethodError: undefined method `attr_accessible` for Posts (call 'Post.connection' to establish a connection): Class
@imrankhanvu
@imrankhanvu 11 жыл бұрын
ok now about the problem, when i run this command post = Post.new(:title => "our first post", :content => "our post content") the console throws a bunch of errors, but the main error is like this, attr_accessible is extracted out of rails a gem. please use new recomonded protction model for params(strong_parameters) or add protected_attributes; to your gemfile to use old one. help me please.
@ShivaprakashYaragal
@ShivaprakashYaragal 8 жыл бұрын
@4.40: its attr_accessor
@deltaupsilonfraternity3982
@deltaupsilonfraternity3982 11 жыл бұрын
Hello, I am learning RoR and I am having issues with this tutorial, and the blog in general. 1st after I activate the server for the localhost I cannot use the command prompt. (I am using windows) Also I get a runtime error when I try to set up the post = Post.new variable. Help?
@AverageGottn
@AverageGottn 11 жыл бұрын
How do I add a column to table with that console?
@sampathchetelli8803
@sampathchetelli8803 10 жыл бұрын
while storing values to post it only storing default values...............please resolve my problem...................
@imrankhanvu
@imrankhanvu 11 жыл бұрын
and some suggestions if u don't mind, when u write and command, its hard to read, because the font is too small, so is it possible that u edit all these lectures and u show all the commands in a subtitle in big size. that way it will be easy for use to read them. thanks a lot.
@bjornsteneram6540
@bjornsteneram6540 11 жыл бұрын
So.. can't seem to find the source code for this video on your site Andrew! Good video tho!
@gadamson12
@gadamson12 11 жыл бұрын
When i do post = Post.new[:title => "Our First Post", :content => "Content for our first post"] it returns nil. Help?
@under_score2268
@under_score2268 11 жыл бұрын
Great video, thank you very much.
@curatedbasics
@curatedbasics 11 жыл бұрын
1.9.3p194 :005 > post = Post.new|:title => "first post", :content => "content") SyntaxError: (irb):5: syntax error, unexpected tASSOC, expecting $end post = Post.new|:title => "first post", :content => "content") hi!! any ideas how to fix this syntax error?
@SouravKen
@SouravKen 11 жыл бұрын
Any luck with the fix. I am trying to learn RoR. While following this tutorial I got stuck on this line. For sure this is because I am using latest version on and clearly unlike Java it does not seem to have backward compatibility. I am googling but not no success yet :(
@ianjamiesonmusic
@ianjamiesonmusic 11 жыл бұрын
Will definitely be switching from PHP.
@vytaslll2
@vytaslll2 10 жыл бұрын
Try Laravel first :)
@ranesh237
@ranesh237 10 жыл бұрын
what is mass assignment?
@allenlee9111
@allenlee9111 11 жыл бұрын
Appreciate for your job!
@rtrnzero
@rtrnzero 11 жыл бұрын
Looks like adding attr_accessible to post.rb caused a run time error when trying to create post = Post.new
@biNuTheFirst
@biNuTheFirst 11 жыл бұрын
thanks bro! veryyyy useful
@rameshswe
@rameshswe 12 жыл бұрын
It is super . i am running ROR in Wampserver + ROR installer
@drewh22
@drewh22 11 жыл бұрын
Thank you!
@BharathRajendran-SRM
@BharathRajendran-SRM 11 жыл бұрын
wow.. i love this tutorial ..how to upload file ...can u explain file concept in 12 video
@millennia
@millennia 11 жыл бұрын
i think its fine.
@TheRoger005
@TheRoger005 8 жыл бұрын
I was enjoying your tutorials until your link to "source code" goes directly to a ridiculous blank insurance advert.
@Soraskull
@Soraskull 12 жыл бұрын
I can testify to how slow it is cause it drives me crazy.
@mayankrajput2102
@mayankrajput2102 9 жыл бұрын
1. irb(main):001:0> on running rails c 2. NoMethodError: undefined method `save' for nil:NilClass on running the post = Post.new.......
@IAMPROJECT45RI
@IAMPROJECT45RI 9 жыл бұрын
2.2.0 :016 > Post.title NoMethodError: undefined method `title' for # Somebody can halp me?
@SANVELXRP
@SANVELXRP 12 жыл бұрын
like it
@nikhilfadnis8009
@nikhilfadnis8009 9 жыл бұрын
audio quality kinda sucks
@4sky
@4sky 11 жыл бұрын
migrate=> where migrations will be stored config=> where you store configurations for ruby stop using the word to describe the word! it doesnt clear up anything...
@JeffRAX
@JeffRAX 5 жыл бұрын
it appears he is not describing the word, but explaining what is in those folders...
@sthardman
@sthardman 11 жыл бұрын
What's up with the audio? Extremely annoying!
Ruby on Rails Tutorial Part 3 - Routing
7:19
andrewperk
Рет қаралды 53 М.
Ruby on Rails Console: Tips & Tricks
12:52
Jesus Castello
Рет қаралды 3,9 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 122 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 2,1 МЛН
Perfect Pitch Challenge? Easy! 🎤😎| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 76 МЛН
Fullstack LMS: Ruby on Rails 7, Hotwire, Tailwind, Stripe, PostgreSQL
8:02:47
Ruby on Rails Tutorial Part 6 - CRUD - Create - Save Method
10:49
Ruby on Rails - Part 1: Hello World
1:15:15
UC Berkeley Events
Рет қаралды 309 М.
Web Development with Ruby On Rails
57:23
SkillBuilders
Рет қаралды 130 М.
Ruby on Rails Tutorial Part 8 - CRUD - Delete - Destroy Method
4:45
The Intro to Rails Screencast I Wish I Had
42:00
Tuts+ Code
Рет қаралды 46 М.
Ruby on Rails - Part 4: Advanced Active Record
50:29
UC Berkeley Events
Рет қаралды 53 М.
Your Command Line, Oxidised
10:09
No Boilerplate
Рет қаралды 205 М.