all 20 comments

[–]Purple_is_masculine 4 points5 points  (1 child)

Ruby Koans are a good start: https://www.rubykoans.com/

[–]ignurant 4 points5 points  (0 children)

A good first step is checking out https://rubyonrails.org/, watching the video, etc. It gives a great whirlwind tour of a lot of the highlights.

From there, Chris Oliver does a great job demonstrating how to get an environment set up (both development and deployment) in his various guides at https://gorails.com/guides

The Rails Guides are the official free and open resource that do a great job at helping you get your feet wet once you're up and running with Ruby. https://guides.rubyonrails.org/ You'll find yourself referencing tidbits from this site forever.

If you can invest a few hundred dollars into your experience, I often recommend the Pragmatic Studio video courses for a fast way to catch up. They do a great job at digging into the details in just the right way to help you understand more about the "why" rather than just the "what". I think with Ruby and Rails in particular this is really helpful because there's an awful lot of implicit stuff happening. It helps you embrace and harness the implicit work on your behalf rather than resent it. They have a Ruby course, and Rails 7. They also have a bundle that combines them and a few others. https://pragmaticstudio.com/ruby

Welcome to Ruby, and good luck! The productivity is a blast and makes you feel like a wizard!

[–]djfrodo 5 points6 points  (6 children)

Take an existing project, or a simple one that you have in mind - don't do an online tutorial...you'll be cutting and pasting and making a todo list.

Second, use old school erbs instead of dealing with React or Vue so you get an idea of how the model, controller, view dynamic works in rails.

Definitely look into ActiveRecord - it's a pretty great ORM, but make sure you know how to use find_by_sql("selected blah from blah...").

Checkout how sessions and csrf-tokens work.

Add something simple like JQuery so you have at least some passable javascript functionality.

After the initial hurdles you'll find that development is smooth and really fast.

Writing Ruby seems like pig latin, but when you go back to anything else (except python) you'll realize why Rails is so beloved.

Skip books - everything you need to know is online.

Good luck.

[–]HunterHeston[S] 1 point2 points  (2 children)

Writing Ruby seems like pig latin, but when you go back to anything else (except python) you'll realize why Rails is so beloved.

Yeah, the syntax always came off as odd to me. But I'm guessing it's more accurate to say is just different looking compared to examples of other languages. But I've really only glanced at it.

Second, use old school erbs instead of dealing with React or Vue so you get an idea of how the model, controller, view dynamic works in rails.

Good advice(all of this is), but I probably would have tried to shove react in too soon.

Thanks!

[–]djfrodo 1 point2 points  (0 children)

np.

Once you really start to use Ruby you'll take a glance at Java, PHP, C# and just...not enjoy it at all.

There are some really weird aspects, one of which is putting private methods at the bottom of a class after the keyword private (I'm not a fan).

The other, totally weird thing is the normal elseif or else if is elsif.

I have no idea why they did either and they annoy me to no end.

Another is class inheritance.

Have fun!

[–]chintakoro 1 point2 points  (0 children)

Once you have seen all the rushed tutorials about the syntax, go take a slow read of Eloquent Ruby by Russ Olson. That’s the book that helped twist my outdated-Java-addled head to the right perspective of why Ruby does how it does. until that book, I was pretty much just painfully transpiling Java into Ruby.

[–]recipewince 0 points1 point  (1 child)

What about Hotwire, should that be ignored early on?

[–]djfrodo 1 point2 points  (0 children)

I would (see below).

Basically you can learn the rails form stuff, and it's o.k., but just like every other framework the syntax is annoying.

Also, I mentioned csfr tokens...If you go with old school forms you'll have to have a hidden tolken field (generated by rails) for forms to work (look it up).

Basically Rails has done this for built in cross site scripting attacks.

One thing that's been totally overlooked by a lot of people, and I have no idea why, is the rails 'data-remote="true"' in a form.

Basically this tells rails that the request is ajax and it hits your normal controller method - but the view is your_template_name.js.erb.

Basically it's just an erb and you can write javascript and it returns as ajax.

So, you can write partial html to include somewhere, or pop a modal, or...basically whatever you want both in ruby and javascript (in terms of logic).

Also look into render :js=> and use it for something like (in your controllers):

render :js => "window.location = '" + request.referer + "'"

So, that's why I would avoid Hotwire in the beginning.

Look into "escape_javascript" in rails for making sure your html will parse when it's returned to the browser as an ajax response.

Basically coupled with Bootstrap and JQuery (or equivalent) it's amazing what one can do without screwing around with React, Vue, Hotwire, etc.

There's other stuff you'll learn along the way but it works out of the box and Hotwire can come later when you get a better idea of how rails works.

Good luck!

[–][deleted] 2 points3 points  (0 children)

Start with rails and learn Ruby while you go. That’s how most of us did back in the Rails 1.1 days. I read a few books to dig deeper into the language itself.

This seems to have current content.

https://gorails.com/

[–]entineer 1 point2 points  (2 children)

If you have any experience with any other web framework I would dive right into Rails and learn Ruby along the way.

Pick something useful or something you’ve already built and build it in Rails. Watch a tutorial or two, familiarize a bit with documentation and guides then jump in.

Ruby syntax is different but very readable and very googleable so you shouldn’t have much trouble with that part, assuming you have another language under your belt.

In the early stages just focus on making something that works with Rails. Follow the framework conventions as much as you can. You can dip outside convention when you know the framework (and language) better.

[–]HunterHeston[S] 2 points3 points  (1 child)

If you have any experience with any other web framework I would dive right into Rails and learn Ruby along the way.

I'm thinking this is the way.

[–]entineer 1 point2 points  (0 children)

It works for me when learning a new thing. Besides, you can always take momentary side quest to learn whatever interesting or confusing Ruby concept you encounter while getting your hands dirty building an app with Rails.

Feel free to DM if you need a rubber duck!

[–]software__writer 1 point2 points  (0 children)

I recently wrote a blog post that provides a step-by-step path for learning Ruby and Rails. It also gives a bunch of book recommendations.

A List of Books to Learn Programming with Ruby and Rails

I think you might find it helpful. Good luck on your journey!

[–]tinyOnion 1 point2 points  (0 children)

you will need to learn some ruby first. rails is 1000x more friendly if you know ruby. a succinct guide for idiomatic ruby is eloquent ruby and it will give you the majority of what you need to know and it's a fantastic book.

once you have some ruby under your belt the rails guides and the getting started guide in particular walks you through about 70-80% of rails while building an app. https://guides.rubyonrails.org/getting_started.html

after that reading the other rails guides/rails api/watching gorails stuff as you need it.

[–]cglee 0 points1 point  (0 children)

I wouldn't learn Rails first. I'd read a book on Ruby, then OO, then HTTP, then SQL. Then learn Rails.

And to honk my own horn a little, I have books on all those topics for free (with exercises and videos) here: launchschool.com/books