bluecodr’s diary

忘れがちなTipsの備忘録。主にUbuntuやRailsについて記載。

rails

wicked_pdfでヘッダーにページ番号を付けたい

PDFを出す際にcontrollerに以下のオプションを付ける。 render :pdf => 'filename', :header => { :right => '[page] of [topage]' }

Bootstrap2のbootstrap-dropdown.jsがタブレットで動かない場合のパッチ

find /home/foo/.rbenv -type f -name "bootstrap-dropdown.js" -exec emacsclient {} \; 55-57行目をコメントアウト (当然ながら)本番環境はasset compileが必要

nginxで"111: Connection refused"が出る場合の対処方法

さくらクラウド(Ubuntu14.04)でnginx, rails unicornを利用した際に以下の様なログが出る場合がある 2015/01/01 12:12:12 [error] 8652#0: *228 connect() failed (111: Connection refused) while connecting to upstream, client: 111.111.111.111, server…

Rails Composerを使って簡単Webアプリ構築

サイト Rails Composer 新しいアプリの作成 rails new foo -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb こんなことが出来る Deviseの導入 Bootstrapの導入 Postgresの指定、設定ファイル自動生成 Google Analyticsの設定 develo…

WebrickでRailsの起動ポートを変更する

例:4000番ポートを指定する場合 config/boot.rbに以下を追記する require 'rails/commands/server' module Rails class Server def default_options super.merge({ :Port => 4000, }) end end end