1719873047

Learn Ruby on Rails lesson 1


# Getting started with rails 7.0 This is going to be a multipart guide that i hope you follow along with. It will not get into the advanced parts of rails but will only show you how easy it is to get started. This guide is based on a small personal library that I own about this subject. The prerequisites for this lesson are simple. Have ruby installed. We will continue from there. This will be an easy first lesson that's mostly just to get everything ready for the work we do later. Ruby comes with a package manager of its own called gem. This is a good way to extend the functionality of ruby. Gems are often stored in their own directory but depending on what you are trying to do you can also enter the ruby directory and make changes or add features to your local instiallation directly. Were not doing that. Rails will install as a gem. simple. ```gem install rails``` Rails has some dependencies. These should be installed automatically. If it prompts you for anything "Y" and move on. The only other thing that you will need is a db for this project. You can use one of your choosing but i will be using sqlite in this project. If you plan on migrating your project to a server you will likely want to switch to standard sql so you can have more functionality if that matters to you. you can check to see if everything you need is installed by running ``` sqlite3 --version rails --version ``` If you get output your good to go. Rails recently updated to version 7.1 but the changes will not effect this project. This guide should be compatible for 6.5 and up (as of july 2024) as thats as far as ive tested it. If there are any issues let me know in comments. Also just update your version. Aint that big a deal. Next up we are going to speedrun getting rails active. This should really only take a min as almost everything is handled for you. It is possible to build a working rails app from scratch but using generators are pretty nice to get a blank template for you. ```rails new name_here``` There are some flags that you can throw here if you want something specific. If you would like to see all the options run ```rails new -h```. Some common things that you may want to look at are all of the skip cmds. If there is something that you dont want include it here. At the end of development when you make a production version of your application it will trim the fat out but if you want it to be as least bloated as possible at that start go nuts. This is the step that you should specify what db your going to use if your not using the default sqlite. There should be a new dir/ now based on the name that you created. Navigate into that dir. There is alot here. Most of the things that youll touch are app/ db/ config/ and .gemfile. If you are experienced with rails and have a specific project in mind, this is the place that you will want to go to your gemfile and add any more features you expect to use in the future. Dont forget to bundle install! Technically youve made a working app already. In your terminal run ```rails server``` and navigate to your localhost address. By default its :3000 but depends on your config. You should see a welcome page letting you know that its working. You will see some feedback in your term when you connect as its handles everything. Next lesson we will break everything down and explain the different parts of the application. see, told you this would be ez.

(2) Comments
amargo85
amargo85
1719873640

at first glance, yes, it seems really easy. as someone who's quite curious, even though it's not my development language, I'll be trying the next steps. Just a tip, shouldn't the title of the post start with a capital letter? ­čśâ­čśâ­čśâ­čśâ but yes, it doesn't matter, because what counts most is the content

xReqX
xReqX
1719873881

oh yea thats right. i just imported file from apostrophe. first line was supposed 2 b title but didnt do it right so i just threw that other 1 up there. granted uve seen me type enough to know i cant spell let alone follow traditional grammatical procedures.