Locked lesson.
About this lesson
Deleting the Pins CSS file and understanding C.R.U.D.
Exercise files
Download this lesson’s related exercise files.
Pins CSS and C.R.U.D..docx58.7 KB Pins CSS and C.R.U.D. - Solution.docx
58.9 KB
Quick reference
Pins CSS and C.R.U.D.
In this video we'll look at the pins.scss file and discuss C.R.U.D.
When to use
Delete the pins.scss file right after you run the scaffold generator.
Instructions
Once we run the scaffold generator, a new pin.scss file is created that overrides our Bootstrap CSS. We need to delete the pins.scss file immediately and our site will go back to normal.
Hints & tips
- Delete the pins.scss file that was created by the scaffold generator
- Pins.scss is located in app/assets/stylesheets
- C.R.U.D. stands for Create, Read, Update, and Destroy (or delete)
- Most websites online are run using the C.R.U.D. concept
- 00:04 Okay, in the last video, we added our pen scaffolding, and that was really cool.
- 00:08 Got a huge step forward in that video, and you saw just how quick and easy it was.
- 00:13 In this video, I wanna spend just a couple of minutes talking about some things that
- 00:17 go along with that.
- 00:18 If you go back to your main web page and hit Reload,
- 00:20 you see everything looks weird all of a sudden.
- 00:23 Well, what happened?
- 00:24 When we created our scaffolding, you see, you look at the terminal,
- 00:28 the generator generated all kinds of stuff for us.
- 00:31 And one of the things it generated was a new style sheet.
- 00:34 So if we go to App > Assets > Stylesheet, remember before we had this bootstrap.
- 00:39 But now we have the saffold one.
- 00:41 And that scaffold CSS file is overwriting our Bootstrap one.
- 00:45 So we need to delete that.
- 00:47 Just right-click on it, and click Delete.
- 00:51 And then, if we come back here and hit Reload,
- 00:53 boom, everything goes back to normal.
- 00:55 So don't forget to do that.
- 00:56 That's kind of weird and needs to be taken care of.
- 00:59 So before we go on,
- 01:00 I wanna talk on the deep here about what we just did in the last video.
- 01:04 Creating that scaffold was incredibly easy, but it did an enormous amount
- 01:08 of stuff that you may not actually appreciate right off the bat.
- 01:11 But there's a word I wanna tell you about that is popular with coders, and
- 01:16 that word is crud, C-R-U-D.
- 01:18 And that stands for, hold on, let's just come back here.
- 01:22 And that stands for create, read, update, and destroy.
- 01:30 Or delete.
- 01:34 And think about all of the popular websites that you know.
- 01:37 Think about Twitter.
- 01:38 What are you doing on Twitter?
- 01:39 You are creating a tweet, you are reading somebody else's tweet,
- 01:43 you're updating one of your tweets, or you're deleting a tweet.
- 01:47 Think about Facebook, what do you do there?
- 01:48 You're creating a Facebook post, you're reading somebody else post,
- 01:52 you're updating your post, or you're deleting a post.
- 01:54 Think about Pinterest, what are you doing?
- 01:56 You are creating a pin, you're reading a pin, you're updating your pint, or
- 01:59 you're deleting your pin.
- 02:00 Think about a blog.
- 02:01 You're creating a blog post, you're reading somebody elses blog post,
- 02:05 you're updating a blog post, or you're deleting a blog post.
- 02:08 That's how the Internet works, that's the main functionality of most websites,
- 02:13 the ability to create, read, update, and delete.
- 02:16 And we've just done that right here in our app by creating this scaffold.
- 02:22 We can create a new pin, we can read a pin, show it,
- 02:27 we can edit it or update it, and we can destroy it.
- 02:33 So you know how to do that with rails with one line of code with creating a scaffold.
- 02:38 And that's huge.
- 02:40 I mean, sure, Facebook is a little more complicated than just create,
- 02:43 reading, updating, and deleting posts.
- 02:45 But not really.
- 02:46 I mean, when you get right down to it, Twitter?
- 02:48 Yeah, it's a little bit more complicated, but not really.
- 02:51 If you have the ability to create, read, update, and delete,
- 02:54 you can build just about anything online.
- 02:57 And that is incredibly powerful.
- 02:59 And you see how easy Rails made it for us to do this.
- 03:03 We have complete database functionality.
- 03:05 It's all tied into the database.
- 03:07 And what database programming did we just do?
- 03:10 None, Rails did it all for us.
- 03:12 It created everything for us.
- 03:14 You don't need to know anything about databases.
- 03:16 And suddenly, we've got a database that does sophisticated stuff,
- 03:19 just as sophisticated as Twitter, Facebook, Pinterest,
- 03:22 any other website you can think of.
- 03:25 Create, read, update, and destroy.
- 03:26 Keep that word CRUD in mind, anytime in the future when you wanna build something,
- 03:31 break it down into how you would create, read, update, and delete.
- 03:34 And use your scaffold here in Rails, and you can build just about anything.
- 03:38 So that's about as deep as we're gonna get in this course, but I wanted to take just
- 03:42 a minute to talk about that ' cause it's such a powerful concept and it's so important.
- 03:46 And it's so easy with Rails that it's good that you understand what's going on here
- 03:50 and why it's so important.
- 03:51 In the next video, we will start customizing this and
- 03:54 doing some other cool things.
- 03:55 And yeah, that's all for this video.
Lesson notes are only available for subscribers.