- Add
gem 'carrierwave'to Gemfile - Run
bundle installto install the new gem - Stop spring:
spring stop - Run
rails generate uploader Image - Mount the newly generated ImageUploader on your Model. I mounted it on
the string type column
imageby adding this in my model's class:
First add the bower-rails and the compass-rails gems to your project's Gemfile:
# Gemfile
gem 'compass-rails'
gem 'bower-rails'Run bundle install and then the generator that comes with bower-rails to set everything up:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Rails console script that can be run on AWS Elastic Beanstalk. | |
| # | |
| # Run this script from the app dir (/var/app/current) as root (sudo script/aws-console) | |
| # | |
| set -xe | |
| EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Profiler | |
| def self.profile(&block) | |
| result = RubyProf.profile do | |
| block.call | |
| end | |
| printer = RubyProf::GraphPrinter.new(result) | |
| printer.print(STDOUT, {}) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssl_certificate Definition | |
| define :ssl_certificate, action: :create do | |
| cert_dir = File.expand_path("../../files/default", __FILE__) | |
| # Find the host certificate | |
| host_cert = File.join( cert_dir, "*.#{params[:name]}.crt" ) | |
| Chef::Logger.error("Could not locate host certificate for #{params[:name]}!") | |
| # Find the intermediate certificate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def assets_same_since?(old_assets_version = nil) | |
| return false if old_assets_version.nil? || old_assets_version.empty? | |
| return false if ENV['FORCE_ASSETS_COMPILATION'] | |
| changed = %x(git diff #{old_assets_version}.. \ | |
| vendor/assets/ \ | |
| app/assets/ \ | |
| config/javascript_translations.yml \ | |
| config/javascript.yml | wc -l).chomp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| releases=`ps aux | grep resque- | sudo pwdx \`awk '{print $2}'\` | sed 's/\(.*\)\/path\/to\/releases\/\(.*\)/\2/' | sed 's/.*No such process//'` | |
| current_release=`readlink /path/to/current | sed 's/\/path\/to\/releases\/\(.*\)/\1/'` | |
| for r in $releases; do | |
| if [ $r = $current_release ]; then | |
| echo 'yes' | |
| else | |
| echo 'no' | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Prefix to C-a | |
| set -g prefix C-a | |
| unbind C-b | |
| bind C-a send-prefix | |
| # Vim bindings | |
| set -g status-keys vi | |
| # Use vim keybindings in copy mode | |
| setw -g mode-keys vi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # render in before_filter | |
| before_filter | |
| render 'template' and return | |
| end | |
| # Render conditional | |
| def index | |
| respond_to do |format| |