Cruddy Buddy

Martina Weidenbaum
Aug 22, 2017 · 3 min read

building a basic crud app

Rails! It’s here. It even says nice things like:

It is hard to believe that two weeks ago, I had no idea how to open rails and now we are using it to build real, live web applications! But despite/because of all of the generous rails magic, it can be a little confusing to know the exact when and how of all the steps. So, I thought I would break it down into smaller steps as a reference point for others who are just starting to learn rails.

The database is king! The very first thing you must understand when building a rails app is that nothing matters if your database is not set up correctly. It is important to write out your relationship models and draw out the has_many, belongs_to and has_many through connections. Once you have drawn these out, you can run

running a migration with resource sets up your model, your db/migrate file, a view folder, a controller and all the routes for the controller.

Woohoo! Check you out! Next, we fill in our tables with the appropriate columns, and set the relationships in our models

Then, my favorite command and yours:

After we seed our application with some cool data, we can add actions to our controllers!

The cruddiest actions of all are:

Index, Show, New, Create, Edit, Update and destroy. The first 6 actions come with a corresponding view page. Each action is either a get or a post so it goes a little something like this…. Action triangles!!!

As we are building our actions, it is always a good idea to check to see that our actual website is working. In your terminal, open a new tab with “command+ t” and type:

Create your form, navigate to the appropriate url and voila — -

All you need to do is continue your cruddy behavior and you could build out your app to be as big or small as you like!

it

could

even

become

as

big

as……….

streeteasy.com

These are the basics. I hope this is helpful!

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade