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
# Merb controller | |
class Users < Application | |
def foo | |
"Foo'ed!" # result: string rendered | |
end | |
def bar | |
render "Rabarbar!" # result: "Rabarbar!" text inside layout rendered | |
end |
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
class ApplicationController < ActionController::Base | |
rescue_from MerbToRails3::ControllerExceptions::Base, :with => :handle_exception | |
def handle_exception(e) | |
render "exceptions/#{e.action_name}" | |
end | |
end |
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
" Vim color file | |
" Maintainer: Roman Gonzalez <romanandnreg at gmail dot com> | |
" Last Change: 2009 Aug 11 | |
" Version: 0.0.1 | |
" Screenshot: http://img.skitch.com/20090811-ti4b27qbftjybmau32ruygjjwx.jpg | |
" URL: http://blog.romanandreg.com | |
" For now this will only work on gvim | |
set background=dark |
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
source 'http://rubygems.org' | |
git 'git://github.com/rails/rails.git' | |
gem 'activesupport', '~> 3.0.0.beta3', :require => 'active_support' | |
gem 'actionpack', '~> 3.0.0.beta3', :require => 'action_pack' | |
gem 'railties', '~> 3.0.0.beta3', :require => 'rails' | |
gem 'actionmailer', '~> 3.0.0.beta3', :require => 'action_mailer' | |
git 'git://github.com/datamapper/dm-core.git' | |
git 'git://github.com/datamapper/dm-more.git' |
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
source 'http://gemcutter.org' | |
git 'git://github.com/rails/rails.git' | |
gem 'activesupport', '~> 3.0.0.beta3', :require => 'active_support' | |
git 'git://github.com/datamapper/dm-core.git' | |
git 'git://github.com/datamapper/dm-more.git' | |
gem 'dm-core', '~> 0.10.3' | |
gem 'dm-aggregates', '~> 0.10.3' | |
gem 'dm-migrations', :git => 'git://github.com/datamapper/dm-migrations.git' |
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 "bundler" | |
Bundler.setup | |
require "dm-core" | |
require "dm-migrations" | |
DataMapper.setup(:default, "mysql://localhost/examples") | |
DataMapper.setup(:logs, "mongo://localhost/examples") | |
class LoggedEvent | |
include DataMapper::Mongo::Resource |
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
Loading development environment (Rails 3.0.0.beta3) | |
ruby-1.8.7-p249 > class ::Heffalump | |
ruby-1.8.7-p249 ?> include DataMapper::Mongo::Resource | |
ruby-1.8.7-p249 ?> def self.default_repository_name; :logs; end | |
ruby-1.8.7-p249 ?> property :id, ObjectID | |
ruby-1.8.7-p249 ?> property :color, String | |
ruby-1.8.7-p249 ?> property :num_spots, Integer | |
ruby-1.8.7-p249 ?> property :striped, Boolean | |
ruby-1.8.7-p249 ?> end | |
=> #<DataMapper::Property @model=Heffalump @name=:striped> |
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
class Subtask | |
include DataMapper::Resource | |
include CommonProperties | |
property :body, String, :required => true, :length => 32, :messages => { :presence => "Subtask can't be blank" } | |
property :creator_id, Integer, :required => true, :index => true | |
property :is_checked, Boolean, :default => false | |
property :task_id, Integer, :required => true, :index => true | |
belongs_to :creator, :model => "User" |
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
/home/kill/.rvm/gems/ruby-1.8.7-p249/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/rendering.rb:129:in `-' | |
/home/kill/.rvm/gems/ruby-1.8.7-p249/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/rendering.rb:129:in `view_assigns' | |
/home/kill/.rvm/gems/ruby-1.8.7-p249/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/rendering.rb:85:in `view_context' | |
/home/kill/.rvm/gems/ruby-1.8.7-p249/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/rendering.rb:113:in `_render_template' | |
/home/kill/.rvm/gems/ruby-1.8.7-p249/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller/rendering.rb:107:in `render_to_body' | |
/home/kill/.rvm/gems/ruby-1.8.7-p249/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/metal/renderers.rb:47:i |
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
ruby-1.8.7-p249 > a = Account.create(:name => "abc") | |
=> #<Account @id=5 @created_at=Thu, 15 Apr 2010 12:40:53 +0200 @updated_at=Thu, 15 Apr 2010 12:40:53 +0200 @name="abc"> | |
ruby-1.8.7-p249 > a.created_at | |
=> Thu, 15 Apr 2010 12:40:53 +0200 | |
ruby-1.8.7-p249 > a.reload | |
=> #<Account @id=5 @created_at=<not loaded> @updated_at=<not loaded> @name=<not loaded>> | |
ruby-1.8.7-p249 > a.created_at | |
=> nil | |
ruby-1.8.7-p249 > a.name = "def" | |
=> "def" |