Ruby's and Ruby on Rails' Overall Popularity Although way behind main contenders, such as PHP or Python, Ruby still makes the cut for the 20 most popular programming languages list in 2022. The 2022 edition of Stack Overflow Annual Developer Survey also places RoR in a similar spot.
It must be said that most of the time, developers claim that Ruby on Rails is slow because of the initially incorrect project architecture, data caching or database optimization. Rails is FAST in terms of the project development speed.
RoR developers are sure - Rails are still relevant in 2020.
Laravel. With over 64,000 stars on Github as of September 2020, Laravel, which stemmed from Symfony (another Ruby on Rails alternative listed in this article) is one of the most popular frameworks for backend development available in 2020 — and this is not without good cause.
To avoid duplicate form submissions, Rails has a nice option for submit tags:
submit_tag "Submit", :disable_with => "Saving..."
This adds behavior to the submit button to disable it once clicked, and to display "Saving..." instead of "Submit".
Rails 4+
DEPRECATION WARNING: :disable_with option is deprecated and
will be removed from Rails 4.1. Use 'data: { disable_with: 'Text' }' instead.
Thus the above becomes:
submit_tag 'Submit', data: { disable_with: 'Text' }
integer.ordinalize is one little method that I just stumbled upon not to long ago.
1.ordinalize = "1st"
3.ordinalize = "3rd"
I'm currently in love with div_for
and content_tag_for
<% div_for(@comment) do %>
<!-- code to display your comment -->
<% end %>
The above code renders this:
<div id="comment_123" class="comment">
<!-- code to display your comment -->
</div>
Want the CSS class to be comment other_class
? No problem:
<% div_for(@comment, :class => 'other_class') do %>
<!-- code to display your comment -->
<% end %>
Want a span and not a div? No problem, content_tag_for
to the rescue!
<% content_tag_for(:span, @comment) do %>
<% end %>
# Becomes...
<span id="comment_123" class="comment">
<!-- code to display your comment -->
</span>
content_tag_for
is also great if you want to prefix you id
. I use it for loading gifs.
<% content_tag_for(:span, @comment, 'loading') do %>
<%= image_tag 'loading.gif' -%>
<% end %>
# Becomes...
<span id="loading_comment_123" class="comment">
<img src="loading.gif" />
</span>
To see a list of gems that are installed, you can run:
gem server
Then point your browser at:
http://localhost:8808
You get a nicely formatted list of your gems with links to rdoc, the web and any dependencies. Much nicer than:
gem list
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With