You need to do this
<%= f.input :message, :input_html => {:rows => 10} %>
<%= f.input :description, :as => :text, :input_html => { 'rows' => 5, 'cols' => 10 } %>
# I've got a have_library call failing when I tried to install the pg gem | |
c:\Users\djberge\Downloads\Ruby>gem install pg -- --with-pg-dir="c:\Program Files (x86)\PostgreSQL\9.1" | |
Building native extensions. This could take a while... | |
ERROR: Error installing pg: | |
ERROR: Failed to build gem native extension. | |
c:/usr/bin/ruby.exe extconf.rb --with-pg-dir=c:\Program Files (x86)\PostgreSQL\9.1 | |
checking for pg_config... yes |
class APIController < ApplicationController | |
include JSONErrors | |
# ... | |
end |
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(); |
You need to do this
<%= f.input :message, :input_html => {:rows => 10} %>
<%= f.input :description, :as => :text, :input_html => { 'rows' => 5, 'cols' => 10 } %>
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
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
# 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 |
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.
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) |
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 } | |