git branch --set-upstream-to <remote-branch>
# example
git branch --set-upstream-to origin feature-branch
# show up which remote branch a local branch is tracking
git branch -vv
sets the default remote branch for the current local branch.
Adding Bootstrap to Rails 7 | |
Reference: https://www.linkedin.com/pulse/rails-7-bootstrap-52-importmap-md-habibur-rahman-habib/ | |
INSTRUCTIONS | |
1. Add the following to Gemfile: | |
gem "bootstrap" | |
gem "sassc-rails" |
require 'rails_helper' | |
RSpec.describe MyWorker, type: :job do | |
include ActiveJob::TestHelper | |
let(:sqs_msg) { double AWS::SQS::ReceivedMessage, | |
id: 'fc754df7-9cc2-4c41-96ca-5996a44b771e', | |
body: 'test', | |
delete: nil } | |
class API::BaseController < ApplicationController | |
def index | |
render json: { active: true } | |
end | |
def authenticate | |
if user = User.authenticate(request.headers['X-AUTH-TOKEN']) | |
sign_in(user, store: false) |
git branch --set-upstream-to <remote-branch>
# example
git branch --set-upstream-to origin feature-branch
# show up which remote branch a local branch is tracking
git branch -vv
sets the default remote branch for the current local branch.
# db/migrations/xxxxxxxxxxxxxx_create_image_attachment.rb | |
class CreateImageAttachments < ActiveRecord::Migration[5.0] | |
def change | |
create_table :image_attachments do |t| | |
t.belongs_to :imageable, polymorphic: true | |
t.attachment :data | |
t.boolean :default, default: false | |
t.timestamps | |
end |
It's important to note that running this reset will drop any existing data you have in the application
heroku restart
heroku pg:reset DATABASE
(no need to change the DATABASE
)heroku run rake db:migrate
heroku run rake db:seed
(if you have seed)One liner
Run rails new --help
to view all of the options you can pass to rails new
:
$ bin/rails new --help
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby
You need to do this
<%= f.input :message, :input_html => {:rows => 10} %>
<%= f.input :description, :as => :text, :input_html => { 'rows' => 5, 'cols' => 10 } %>
function OnBlurComponent({ onBlur }) { | |
const handleBlur = (e) => { | |
const currentTarget = e.currentTarget; | |
// Check the newly focused element in the next tick of the event loop | |
setTimeout(() => { | |
// Check if the new activeElement is a child of the original container | |
if (!currentTarget.contains(document.activeElement)) { | |
// You can invoke a callback or add custom logic here | |
onBlur(); |
class APIController < ApplicationController | |
include JSONErrors | |
# ... | |
end |