justin
December 4, 2014, 1:05am
1
Any favorite links for Ruby or Rails best practices?
Here’s a few that come to mind:
I just went through the AirBnb one. So AWESOME !
Lots of good Ruby tips, such as using named capture groups rather than $1, $2.
Like this:
/\$(?<dollars>\d+)\.(?<cents>\d+)/ =~ "$3.67" #=> 0
dollars #=> "3"
justin
December 4, 2014, 5:32am
2
This is the only issue I’ve had so far with the AirBnb guide:
opened 05:30AM - 04 Dec 14 UTC
closed 07:53PM - 04 Dec 14 UTC
Should the style guide mention:
Named parameters
Using the { key: value } rather than the { :key => value } syntax
justin
December 5, 2014, 3:45am
3
Just created a PR to my fork of the AirBnb Style guide, now the RailsOnMaui style guide:
https://github.com/justin808/ruby/pull/1
andyl
December 6, 2014, 8:38pm
4
I have two suggestions re: best practices for Rails:
read lots of code - see how others are doing it
following the guidelines set out in “Growing Rails Applications In Practice”
(see https://pragprog.com/book/d-kegrap/growing-rails-applications-in-practice )
GRAPI advocates a minimalistic coding style that relies on the object-oriented basics in Ruby to structure and organize your code. For me, this has made a world of difference.
This is useful:
http://guidelines.plataformatec.com.br/ruby.html
It’s a more concise, albeit less comprehensive version of the bbatsov Style Guide
Hello, I have trouble integrating react_on_rails with my ROR application but It’s required ruby 2.3.0. How can I use react_on_rails gem with ruby 2.1.5 please help
justin
August 11, 2017, 12:40am
7
@sankima Supposedly we work with Rails 3. If you really cannot make this work with Ruby 2.1.5, please post an issue to https://github.com/shakacode/react_on_rails .
I just suggest reading a good code and watching how others do it (live, if you can, and video for the first time)
To make a long story short here https://www.sitepoint.com/10-ruby-on-rails-best-practices-3/ you can find a lot of useful info
I’ve learned best from reading other people’s code and watching how other developers go about solving problems.
There are some good resources for Rails best practices here: https://github.com/ankane/rails-best-practices