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
gem 'rails', '3.1.0.rc5' | |
gem 'thin' | |
gem 'foreman' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do | |
gem 'sass-rails', "~> 3.1.0.rc" | |
gem 'coffee-rails', "~> 3.1.0.rc" |
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
$ cat Procfile | |
web: rails server thin -p $PORT | |
$ gem list | grep foreman | |
foreman (0.19.0) | |
$ ps aux | grep thin | |
kmamykin 13773 0.0 0.0 4156 864 pts/2 S+ 14:22 0:00 grep thin | |
$ foreman start | |
14:22:36 web.1 | started with pid 13897 | |
14:22:50 web.1 | => Booting Thin | |
14:22:50 web.1 | => Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:5000 |
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
task :renderview => :environment do | |
app = YourApp::Application | |
app.routes.default_url_options = { :host => 'xxx.com' } | |
controller = YourController.new | |
view = ActionView::Base.new(app.config.paths.app.views.first, {}, controller) | |
view.class_eval do | |
include ApplicationHelper | |
include app.routes.url_helpers | |
end | |
puts view.render(:template => 'your/action') |
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
# loosely based on: | |
# http://shiflett.org/blog/2010/jul/auto-increment-with-mongodb | |
new_id = Mongoid.master["sequences"].find_and_modify | |
:query =>{"_id"=>"<name of your business entity>"}, | |
:update=>{"$inc"=>{"seq"=>1}}, | |
:upsert=>true, | |
:new =>true #<-- this causes the new incremented id to be returned |
NewerOlder