User Tools

Site Tools


software:rails

Rails

Tips

locales and i18n

If you plan to change the default locale prepare yourself to fight a lot with your app.
Theoretically everything should works fine and out of the box but problems are very common, especially with dates.
I strongly suggest you to immediately add your local file from here

Find duplicates in the database

User.select(:first_name,:last_name).group(:first_name,:last_name).having("count(*) > 1").size

Favourite gems

better_errors

Better Errors replaces the standard Rails error page with a much better and more useful error page. It is also usable outside of Rails in any Rack app as Rack middleware.

rails-footnotes

Every Rails page has footnotes that gives information about your application and links back to your editor

seed_dump

Seed Dump is a Rails 4 and 5 plugin that adds a rake task named db:seed:dump. It allows you to create seed data files from the existing data in your database.

awesome_print

Awesome Print is a Ruby library that pretty prints Ruby objects in full color exposing their internal structure with proper indentation. Rails ActiveRecord objects and usage within Rails templates are supported via included mixins.

switch_user

Inspired from hobo, switch_user provides a convenient way to switch current user without needing to log out and log in manually.

progress_bar

ProgressBar is a simple Ruby library for displaying progress of long-running tasks on the console. It is intended to be as simple to use as possible.

geocomplete_rails

jQuery Geocoding and Places Autocomplete Plugin

rails_admin & rails_admin-i18n

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data

eu_cookies

A Rails solution to the European Cookie Law issue.

Installation

The automatic installation of this gem is a little bit trivial, take a look to the procedure and do it manually

rails-erd

Generate Entity-Relationship Diagrams for Rails applications

Verify that Graphviz is installed and in your path, or use filetype=dot.

but…. graphviz is installed! This happen when graphviz exit unexpectedly, probably because this bug Add this initializer:

require 'rails_erd/domain/relationship'

module RailsERD
  class Domain
    class Relationship
      class << self
        private

        def association_identity(association)
          Set[association_owner(association), association_target(association)]
        end
      end
    end
  end
end
software/rails.txt · Last modified: 2017/10/18 11:27 by Michele Porelli