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
» rake routes | |
root GET / pages#home | |
» export CONTROLLER='non-existing-controller' | |
» rake routes | |
» unset CONTROLLER | |
» rake routes | |
root GET / pages#home |
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 ProductsController < ApplicationController | |
respond_to :html, :xml | |
def index | |
@products = Product.all | |
respond_with @products | |
end | |
def show | |
@product = Product.find(params[:id]) |
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
# Hook to save the html page of every failed scenario into the temp | |
# file directory taht it can be checked after cucumber has finished running. | |
require 'fileutils' | |
require 'capybara/util/save_and_open_page' | |
FAILED_SCENARIO_PAGES_PATH = File.join Rails.root, 'tmp', 'failed_scenarios' | |
FAILED_SCENARIO_IMAGES_PATH = File.join Rails.root, 'tmp', 'failed_scenarios_images' | |
FileUtils.rm_rf FAILED_SCENARIO_PAGES_PATH | |
FileUtils.rm_rf FAILED_SCENARIO_IMAGES_PATH |
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
MyApp::Application.routes.draw do | |
# works mostly but has problems with `url_for :controller => 'module/controller'` | |
resources :posts, :controller => 'Module::Controller' | |
# works | |
resources :articles, :controller => 'module/controller' | |
end |
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 Article < ActiveRecord::Base | |
end | |
module Posts | |
end | |
Posts::Builder # => uninitialized constant Posts::Builder | |
Article::Builder # => ActiveRecord::Associations::Builder | |
Post.const_get('Builder') # => ActiveRecord::Associations::Builder |
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
diff --git a/lib/spring.rb b/lib/spring.rb | |
index 38a22bf..20669c6 100644 | |
--- a/lib/spring.rb | |
+++ b/lib/spring.rb | |
@@ -50,6 +50,7 @@ class Spring | |
end | |
def run(args) | |
+ puts "#run" | |
boot_server unless server_running? |
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
<%= form_for(@post) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
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 User < ActiveRecord::Base | |
validates :account_id, :presence => true | |
end | |
# in the View (using simple_form): | |
# | |
# f.select :account, :collection => Account.all |
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
railties :: (refactor_plugin_new_generator) » ./bin/rails plugin new ~/Projects/playground/rails/full_engine --full | |
create | |
create README.rdoc | |
create Rakefile | |
create full_engine.gemspec | |
create MIT-LICENSE | |
create .gitignore | |
create Gemfile | |
create app/models | |
create app/models/.keep |
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
user system total real | |
variable 1.590000 0.000000 1.590000 ( 1.599274) | |
AR 69.490000 2.440000 71.930000 ( 71.920999) | |
AR is 44.97 times slower. |