# Getting Started vs Active Record

**URL:** <https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793>\
**Category:** rubyonrails-docs\
**Created:** [May 16, 2024, 7:25pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793 "2024-05-16T19:25:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![misscrf](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/misscrf/32/11923_2.png) [@misscrf](https://discuss.rubyonrails.org/u/misscrf)\
**Post date:** [May 16, 2024, 7:25pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/1 "2024-05-16T19:25:06Z")

</div>

I went through the Getting Started tutorial. I have some Ruby programming experience, but not on Rails. It was within the API context of an e-discovery program called Nuix (not Unix). In any event, I got through the tutorial and built the blog site with all the additions to forms, logging in, etc.

The next doc is for Active Record and explains a lot about how Ruby has naming conventions to translate to SQL, which I also understand. My struggle is that I liked the first tutorial doc because it was hands-on. I could follow it and test it. I have SQL Express in my environment, and this is the meat of what I want to get into. CRUD operations with a SQL DB. Is there any hands-on tutorial documentation where I can follow along and build a connection to a current db that I have or even create a new test one to connect with and build out?

I would love that kind of resource. Thank you!

---

<div class="post-metadata">

**Author:** ![walterdavis](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/walterdavis/32/705_2.png) [@walterdavis](https://discuss.rubyonrails.org/u/walterdavis)\
**Post date:** [May 16, 2024, 8:18pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/2 "2024-05-16T20:18:13Z")

</div>

You might want to try the [https://rubytutorial.org](https://rubytutorial.org) where you build a Twitter clone. It’s been around for almost as long as Rails, and it stays up to date with the latest version and working practices. Another great tutorial (plus general helpful workflow and business and Agile tips) is the book [Agile Web Development with Rails](https://pragprog.com/titles/rails7/agile-web-development-with-rails-7/).

Either one of those will take you right up through the entire framework, and get you acquainted with how and often why Rails does things the way it does.

Walter

---

<div class="post-metadata">

**Author:** ![misscrf](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/misscrf/32/11923_2.png) [@misscrf](https://discuss.rubyonrails.org/u/misscrf)\
**Post date:** [May 16, 2024, 8:21pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/3 "2024-05-16T20:21:50Z")

</div>

Thanks, will those include connecting to a SQL db? That’s what I’m really after.

---

<div class="post-metadata">

**Author:** ![misscrf](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/misscrf/32/11923_2.png) [@misscrf](https://discuss.rubyonrails.org/u/misscrf)\
**Post date:** [May 16, 2024, 8:32pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/4 "2024-05-16T20:32:38Z")

</div>

Looks like I can’t get to [rubytutorial.org](http://rubytutorial.org):

 ![rubytutorial](https://global.discourse-cdn.com/rubyonrails/original/2X/2/20cb9e8c7e7e14f4e3af078b7a5453e8a0df9275.jpeg)

Do I have something wrong?

---

<div class="post-metadata">

**Author:** ![walterdavis](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/walterdavis/32/705_2.png) [@walterdavis](https://discuss.rubyonrails.org/u/walterdavis)\
**Post date:** [May 16, 2024, 9:00pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/5 "2024-05-16T21:00:34Z")

</div>

Nope, that is entirely my fault. It’s [https://railstutorial.org](https://railstutorial.org)

Walter

PS: Connection to a Microsoft SQL server is not going to be documented in either of those tutorials, both of which will encourage you to use SQLite as you are learning. But to connect to a MS SQL server, you simply need to select [the appropriate adapter gem](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) when [setting up your application](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter?tab=readme-ov-file#new-rails-applications). Rails is mostly database engine agnostic.

PPS: SQLite is a fully capable SQL RDBMS. There is very little that you cannot do with it. And it saves all of its data in a tiny file in your project folder, so you are never very far from just deleting it and running `rails db:migrate` again if you get frustrated.

---

<div class="post-metadata">

**Author:** ![misscrf](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/misscrf/32/11923_2.png) [@misscrf](https://discuss.rubyonrails.org/u/misscrf)\
**Post date:** [May 16, 2024, 9:33pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/6 "2024-05-16T21:33:20Z")

</div>

Thanks for the fix. So when building a web app, is it recommended to just use an internal SQLite db structure and forego having a fully developed SQL schema? Part of what I love about SQL is my ability to build reusable views and stored procs. They handle 90%+ of CRUD work in reusable models. It sounds like I will have to work at building views and stored procs into rails models and controllers. Am I understanding that correctly?

Thanks again for all your replies and guidance.

---

<div class="post-metadata">

**Author:** ![walterdavis](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/walterdavis/32/705_2.png) [@walterdavis](https://discuss.rubyonrails.org/u/walterdavis)\
**Post date:** [May 16, 2024, 11:08pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/7 "2024-05-16T23:08:23Z")

</div>

When learning Rails for the first time, or even when you want to spike out an idea to see if it will work, it’s fast and easy to use SQLite. And if you want to expand on a quick throw-away demo, you can change to a different database by updating a few (maybe three) files.

That’s possible and even easy because you define your logic and relationships within the Ruby code in your project. If you build complexity into your database too early, you become dependent on the specifics of that complexity, and it becomes enormously difficult to change direction and be agile.

In contrast, if you use the framework for what it is good for, and define your database structures using migrations, then it doesn’t much matter which RDBMS you choose, or whether you change part-way through.

The time to refine your data with views and materialized views, or to move logic into stored procedures, is much later—when you are tuning the final successful application for the traffic it actually receives.

I recommend that you work all the way through the Rails Tutorial or similar, and learn more about the width and breadth of Rails before you skip around any of its conventions. They are there because they pave the 80% path for you. (Someone once likened it to building a skyscraper, but getting to start at the 30th floor.) All the busywork and time-sucking decisions take energy that is better applied to the 20% of your app that is truly unique.

Walter

---

<div class="post-metadata">

**Author:** ![misscrf](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/misscrf/32/11923_2.png) [@misscrf](https://discuss.rubyonrails.org/u/misscrf)\
**Post date:** [May 17, 2024, 2:47am UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/8 "2024-05-17T02:47:12Z")

</div>

Thank you for all your advice. I definitely plan to go through everything. I just know the table structure I want to build and I can do it so fast in SQL. It would be really helpful if I could migrate a SQL table structure and even data to SQLite in a ruby site I want to develop in my sandbox.

---

<div class="post-metadata">

**Author:** ![ChrisJ](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@ChrisJ](https://discuss.rubyonrails.org/u/ChrisJ)\
**Post date:** [May 17, 2024, 6:50am UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/9 "2024-05-17T06:50:12Z")

</div>

While I am also new to Rails, I would like to throw in one aspect that in my understanding is at the core of Rails: one of its main value propositions is the use of Active Record as the ORM (object-relational manager).

This also means that one should probably start without SQL at all. Yes, my start would probably also be faster with SQL instead of Active Record, but only for a short while. So I put this initial extra effort into the "learning curve’ bucket.

---

<div class="post-metadata">

**Author:** ![davetron5000](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/davetron5000/32/1111_2.png) [@davetron5000](https://discuss.rubyonrails.org/u/davetron5000)\
**Post date:** [May 17, 2024, 3:56pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/10 "2024-05-17T15:56:11Z")

</div>

Just want to echo some of this so it’s not lost in the other helpful info here:

- Rails is designed such that it manages the schema via the “migrations” concept.
- Rails is designed around logic existing in Ruby, not in stored procedures.
- Rails is designed to use caching in the server and not via views.
- Rails is designed to use SQLite when you are learning, and then a standalone DB like MySQL or Postgres for actual work and/or production deployments.

That’s not to say that you can’t import an existing schema, create and invoke stored procedures, manage views and access them easily, or use a less common database server. But what’s important is that if you are trying to both learn Rails and do things in an unconventional way, it’s going to be very difficult.

Learn Rails the way it is designed, even if you know you might want to do things differently. It’s _far_ easier to do unconventional things with Rails when you understand its conventions - you gotta learn the rules to break the rules, so to speak.

---

<div class="post-metadata">

**Author:** ![Lorin\_Thwaits](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/lorin_thwaits/32/9491_2.png) [@Lorin\_Thwaits](https://discuss.rubyonrails.org/u/Lorin_Thwaits)\
**Post date:** [May 20, 2024, 9:24am UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/11 "2024-05-20T09:24:24Z")

</div>

> [@misscrf](#):
>
> It would be really helpful if I could migrate a SQL table structure and even data to SQLite in a ruby site I want to develop in my sandbox.

Guess what – you can! Just put **[The Brick gem](https://github.com/lorint/brick)** into an empty Rails app, point the app at your database (this is done in the `database.yml` file), and then run these commands which will build out the migrations and seeds files for you:

```ruby
bin/rails g brick:migrations
bin/rails g brick:seeds

```

You can also build out basic models and controllers if you like:

```ruby
bin/rails g brick:models
bin/rails g brick:controllers

```

After building these out, you can either remove **The Brick** , or keep it there – up to you.

If you share a sample database with me then I can create a short tutorial video about what is possible with this gem.

---

<div class="post-metadata">

**Author:** ![misscrf](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/misscrf/32/11923_2.png) [@misscrf](https://discuss.rubyonrails.org/u/misscrf)\
**Post date:** [May 31, 2024, 6:22pm UTC](https://discuss.rubyonrails.org/t/getting-started-vs-active-record/85793/12 "2024-05-31T18:22:16Z")

</div>

Thank you all for the replies. I know you are all right. I just need to keep plugging forward. I want to go through the next tutorials, I just wish they were more hands-on, like the blog site one was. I want to be able to do the steps, so I can see what happens as I do it.
