Rails Envy: 6 Reasons to use Webbynode
Webbynode is a very affordable VPS host (256 RAM for $15) which has great support for Rails applications.
Related cards:
How to use Simplecov to find untested code in a Rails project with RSpec and Cucumber
Simplecov is a code coverage tool. This helps you to find out which parts of your application are not tested.
Integrating this in a rails project with rspec, cucumber and parallel_tests is easy.
- Add i...
Rails: When to use :inverse_of in has_many, has_one or belongs_to associations
When you have two models in a has_many
, has_one
or belongs_to
association, the :inverse_of
option in Rails tells ActiveRecord that they're two sides of the same association.
Example with a has_many
/ belongs_to
association:
c...
6 front-end techniques for Rails developers. Part I: From big ball of mud to separated concerns
Amazing guide how to divide a ball of Javascript spaghetti distinct separate layers (model, view, controller, backend adapter).
It does not use a Javascript framework.
Rails: How to use custom flash types in controllers
Rails supports alert
and notice
as default flash types. This allows you to use these keys as options in e.g. redirect_to
and as a helper in views e.g. <%= notice %>
(instead of flash[:notice]
).
class SomeController < ApplicationReco...
How to use Rails URL helpers in any Ruby class
If you have any class which requires access to some path methods generated by your routes. Even though you could technically include Rails.application.routes.url_helpers
, this may include way too many methods and even overwrite some class method...
Rails always tries to use a layout with the same name as your controller
If you have a FooController
and also have a layout app/views/layouts/foo.html
, Rails will use this without being told so.
This is super convenient except never.
Rails: How to use a n:m association as 1:n association
Sometimes you might want to limit the number of associated records in a has_many
association, but cannot add a foreign key to the other model (using belongs_to
).
There are [many](http://stackoverflow.com/questions/8153051/rails-how-to-limit-n...
How to negate scope conditions in Rails
Sometimes you want to find the inverse of an ActiveRecord scope. Depending on what you want to achieve, this is quite easy with Rails 7, and a bit more complicated with Rails 6 and below, or when the inverse scope may contain NULL values. [1]
The...
How to make changes to a Ruby gem (as a Rails developer)
At makandra, we've built a few gems over the years. Some of these are quite popular: spreewald (> 1M downloads), active_type (> 1M downloads), and geordi (> 200k downloads)
Developing a Ruby gem is different from developing Rails applications, w...