From e2d0a3b87c3ee177515876524c6e9940bf7263fd Mon Sep 17 00:00:00 2001 From: Tarik Amar Date: Mon, 13 Feb 2023 14:33:29 +0000 Subject: [PATCH] New docs: Ruby on Rails & irb --- README.md | 7 ++++++- irb.md | 7 +++++++ ror.md | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 irb.md create mode 100644 ror.md diff --git a/README.md b/README.md index 2f30729..b2290a2 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,18 @@ # Docs +* [mail](./mail.md) * [bepo.md](./bepo.md) * [docker.md](./docker.md) * [fail2ban.md](./fail2ban.md) * [iptables.md](./iptables.md) -* [mail](./mail.md) +* [irb.md](./irb.md) +* [jsx-ts.md](./jsx-ts.md) * [mongodb.md](./mongodb.md) * [mysql.md](./mysql.md) * [nginx.md](./nginx.md) +* [postgresql.md](./postgresql.md) +* [ror.md](./ror.md) +* [irb.md](./irb.md) * [shell.md](./shell.md) * [symfony.md](./symfony.md) * [vim.md](./vim.md) diff --git a/irb.md b/irb.md new file mode 100644 index 0000000..649d6bd --- /dev/null +++ b/irb.md @@ -0,0 +1,7 @@ +# IRB + +## See current configuration + +```irb +IRB.conf +``` diff --git a/ror.md b/ror.md new file mode 100644 index 0000000..b025f00 --- /dev/null +++ b/ror.md @@ -0,0 +1,35 @@ +# Ruby On Rails + +## Controller + +```shell +bin/rails generate controller Articles index [--skip-routes] +``` + +## Model + +```shell +bin/rails generate model Article title:string body:text +``` +> Model names are singular, because an instantiated model represents a single data record. +> To help remember this convention, think of how you would call the model's constructor: +> we want to write `Article.new(...)`, `not Articles.new(...)`. +[source](https://guides.rubyonrails.org/getting_started.html#mvc-and-you-generating-a-model) + +### Add record + +```shell +bin/rails console + +entity = EntityClass.new(propertyOne: "value") +entity.save +entity +EntityClass.find(1) +EntityClass.all +``` + +## Routes + +```shell +bin/rails routes +```