Skip to content

Instantly share code, notes, and snippets.

def add(*numbers)
numbers.inject(0) { |sum, number| sum + number }
end
def add_with_message(message, *numbers)
"#{message} : #{add(*numbers)}"
end
puts add_with_message("The Sum is", 1, 2,32 ,3)
@edj979
edj979 / gist:1d836f65717f1f48ac3f
Last active November 3, 2015 23:11
Migration error?
Last login: Tue Nov 3 13:57:12 on ttys000
Macbooks-MacBook-Pro:pinterestingb macbook$ bin/rake db:migrate RAILS_ENV=development
rake aborted!
SyntaxError: /Users/macbook/Desktop/pinterestingb/db/migrate/20151103183304_devise_create_users.rb:1: syntax error, unexpected tSYMBEG, expecting '<' or ';' or '\n'
class DeviseCreate:installs ActiveRecord::Migration
^
/Users/macbook/Desktop/pinterestingb/db/migrate/20151103183304_devise_create_users.rb:3: syntax error, unexpected tIDENTIFIER, expecting tCONSTANT
create_table(::installs) do |t|
^
/Users/macbook/Desktop/pinterestingb/db/migrate/20151103183304_devise_create_users.rb:5: syntax error, unexpected tSYMBEG, expecting keyword_end