git log -g main
git stash show -p stash@{0}
ctrl/cmd + \
I18n
and incorporating specific HTML
instructions, such as the requirement to set a string in bold, we follow this approach:# config/locales/en.yml en: homepage: services: title: "This is the <strong>example</strong>"
html_safe
method in views like:<h1><%= t(:title, scope: %w[homepage services]).html_safe %></h1>
HTML
tag can work effectively.ctrl/cmd + shift + a
:back
symbol in Rails is often used to generate a URL that represents the previous page or location the user came from. It's commonly utilized in conjunction with methods like redirect_to
redirecting users back to where they were before performing a specific action.redirect_to
you can use :back
with the redirect_to
method to send the user back to the previous page:redirect_to :back
:back
as the path in a link to create a "Back" button or link:<%= link_to 'Back', :back, class: 'btn btn-primary' %>
--force
to skip prompts.rails db:system:change --to=postgresql
Enumerable#cycle
offers an easy way to either repeat a certain pattern n times or just to switch between two predefined states. irb> array = [1, 2, 3] => [1, 2, 3] irb> array.cycle(3).to_a => [1, 2, 3, 1, 2, 3, 1, 2, 3]
irb> button = ['on', 'off'].cycle => # irb> button.next => "on" irb> button.next => "off"
export EDITOR=
bundle open
wicked_pdf
gem is:template: 'folder/file', formats: [:html]
:not
pseudo selector is useful for styling a group of elements while leaving the last (or specified) element unstyled.One Two Three Four
.css-not-selector-shortcut { display: flex; }
ul { padding-left: 0; }
li { list-style-type: none; margin: 0; padding: 0 0.75rem; }
li:not(:last-child) { border-right: 2px solid #d2d5e4; }
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
bin/rails db:environment:set RAILS_ENV="YOUR_ENVIRONMENT"
'/'
even though you have another enable route '/welcome'
.app/controllers/application_controller.rb
:def after_sign_in_path_for(resource) welcome_path end
heroku apps
heroku apps:info --app example