try
User.all.pluck(:email)
instead of
User.select(:email).map(&:email)
overwrite default attributes
def owner=(ownder)
self.previous_owner = owner
This file contains 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
require 'rubygems' | |
# require 'spork' | |
#uncomment the following line to use spork with the debugger | |
#require 'spork/ext/ruby-debug' | |
# Spork.prefork do | |
# # Loading more in this block will cause your tests to run faster. However, | |
# # if you change any configuration or code from libraries loaded here, you'll | |
# # need to restart spork for it take effect. | |
# # This file is copied to spec/ when you run 'rails generate rspec:install' |
This file contains 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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
#GIT
#reset the current head to origin status
git reset --hard origin master
#clean the repo & delete the untracked files
#!/bin/bash --login -fp alex
# IMPORTANT: Source RVM as a function into local environment.
# Otherwise switching gemsets won't work.
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
source "$HOME/.rvm/scripts/rvm"
- Install RVM
- Install Ruby 1.9.2
$ rvm install 1.9.2
- I had to do this business per the instructions I saw when I ran that command:
enable test suit in Gemfile
group :test, :development do
gem 'guard'
gem 'guard-rspec'
gem "rspec-rails"
gem 'guard-zeus'
gem "factory_girl_rails", "~> 4.0"
gem 'mysql2'
Becuase EC2 and Elastic Beanstalk instance will apply load balancer, so no static IP address is assigned. So the only valid option is to create "www" cname that opint to the EC2 instantces load balancing url. However, if you want to change the root level domian, most of DNS provider won't allow you to do so, cause the URL is not a valid ip address. Some DNS provider allows you to create @ cname and point to 'app.url'
Alternatively, could use AWS Router 53. Router 53 helps you created hosted zone that then define record sets. So you could create an "Alias" www or root then point to Load Balancer.
#HTTPS SSL on AWS
This file contains 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
function pr () { | |
local repo=`git remote -v | grep "origin" | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"` | |
local branch=`git name-rev --name-only HEAD` | |
echo "... pushing current branch \"$branch\" in \"$repo\" to github" && | |
$(git push origin $branch) && | |
echo "... push succeed" && | |
target_branch=$1 | |
echo "... creating pull request for branch \"$branch\" in \"$repo\"" && | |
if [[ ! -z $target_branch ]]; then | |
open https://github.com/$repo/pull/new/$target_branch...$branch |