+-----------------------+------------------+-----------------+
| | eager load paths | auto load paths |
+-----------------------+------------------+-----------------+
| Rails 3 (development) | auto loaded | auto loaded |
| Rails 4 (development) | auto loaded | auto loaded |
| Rails 3 (production) | eager loaded | auto loaded |
| Rails 4 (production) | eager loaded | eager loaded |
+-----------------------+------------------+-----------------+
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
sudo apt-get install redis-server | |
# It's optional. It gives redis-cli tool among others. | |
sudo apt-get install redis-tools | |
# Start/Stop/Restart/Status redis server | |
sudo service redis-server [start|stop|restart|status] |
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
bin/rake erd attributes="foreign_keys, primary_key, inheritance" inheritacne=true notation=bachman polymorhism=true |
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
send(:_layout) gives current layout |
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
require 'open-uri' | |
require 'nokogiri' | |
doc = Nokogiri::XML(open("http://www.blic.rs/rss/danasnje-vesti")) | |
items = doc.xpath("//item") | |
puts "Укупан број данашњих вести: #{items.count}" | |
items.each do |item| |
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
http://blog.mattwynne.net/2012/04/09/hexagonal-rails-introduction/ | |
http://darwinweb.net/articles/modular-development-on-rails |
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 CompressedRequests | |
def initialize(app) | |
@app = app | |
end | |
def method_handled?(env) | |
!!(env['REQUEST_METHOD'] =~ /(POST|PUT)/) | |
end | |
def encoding_handled?(env) |
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
http://winstonyw.com/2014/03/03/time_now_vs_time_zone_now/ |
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
$ heroku pg:backups -a tti-cedar | |
$ curl -o tmp/legacy-a665.dump "urlfrompreviouscommand" | |
Remove all conections to database (for example shut down rails servers or rails console). | |
# From legacy project: | |
$ bundle exec rake db:drop | |
$ bundle exec rake db:create | |
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U ivanbisevac1 -d tti_development tmp/legacy-a665.dump | |
$ bundle exec rake db:migrate |
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
https://help.ubuntu.com/community/PostgreSQL | |
sudo -u postgres psql |