bundle e rails_best_practices
Use this to organize translations and auto-translate missing ones
bundle e i18n-tasks normalize
<%# part of this article: https://medium.com/@dyanagi/a-bulma-form-builder-for-ruby-on-rails-applications-aef780808bab %> | |
<hr> | |
<%- if controller_name != 'sessions' %> | |
<p><%= link_to t(".sign_in"), new_session_path(resource_name) %></p> | |
<% end %> | |
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> | |
<p><%= link_to t(".sign_up"), new_registration_path(resource_name) %></p> |
<%# part of this article: https://medium.com/@dyanagi/a-bulma-form-builder-for-ruby-on-rails-applications-aef780808bab %> | |
<div class="section"> | |
<div class="container"> | |
<div class="content is-medium is-narrow"> | |
<h2><%= t('.sign_up') %></h2> | |
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> | |
<%= render "layouts/error_messages", resource: resource %> |
# config/initializers/bulma_form_builder.rb | |
# There are a few things to mention: | |
# 1) See the article at the URL for sample code with screenshots and more information. | |
# URL: https://medium.com/@dyanagi/a-bulma-form-builder-for-ruby-on-rails-applications-aef780808bab | |
# 2) This may not have covered all form controls. | |
# Form builder for Bulma | |
# Reference: https://bulma.io/documentation/form/ | |
class BulmaFormBuilder < ActionView::Helpers::FormBuilder |
class Example | |
NAME = "this is constant" | |
SECRET_NAME = "this is a secret name" | |
private_constant :SECRET_NAME | |
def self.foo | |
@foo ||= "this is foo" | |
end | |
def self.bar |
# frozen_string_literal: true | |
# Macro Style Methods style guide (DRAFT) | |
# | |
# Let me know if you have a good idea! This is still a draft. | |
# | |
# Reference: https://github.com/rubocop-hq/rails-style-guide#macro-style-methods | |
class User < ActiveRecord::Base | |
include Sortable | |
extend SomethingSpecial |
# lib/tasks/dev.rake | |
if Rails.env.development? | |
namespace :dev do | |
desc 'Drop, create, load schema, migrate, seed, and populate sample data' | |
task prepare: ['db:drop', 'db:create', 'db:schema:load', | |
'db:migrate', 'db:seed', :populate_sample_data] do | |
puts 'Ready to go!' | |
end | |
desc 'Populates the database with sample data' |
@import "bootstrap"; | |
@import "font-awesome"; | |
// Fix the issue that this block does not show | |
// https://github.com/twbs/bootstrap/issues/23454#issuecomment-468657049 | |
.invalid-feedback { | |
display: block; | |
} | |
// Section |
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks | |
# The "main" locale. | |
base_locale: en | |
## All available locales are inferred from the data by default. Alternatively, specify them explicitly: | |
locales: [en, ja, zh-CA, zh-TW] | |
## Reporting locale, default: en. Available: en, ru. | |
internal_locale: en | |
# Read and write translations. |