Permalink
Browse files

Merge pull request #6836 from flyerhzm/ruby_19_hash

Ruby 1.9 hash syntax for generated code
  • Loading branch information...
2 parents 95b0f63 + a6a4813 commit 1327660bfd7332f6db673669eb16c5a8b9e56e4b @carlosantoniodasilva carlosantoniodasilva committed Jun 23, 2012
@@ -1,5 +1,5 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :reset_session instead.
- protect_from_forgery :with => :exception
-end
+ protect_from_forgery with: :exception
+end
@@ -2,7 +2,7 @@
<html>
<head>
<title><%= camelized %></title>
- <%%= stylesheet_link_tag "application", :media => "all" %>
+ <%%= stylesheet_link_tag "application", media: "all" %>
<%%= javascript_include_tag "application" %>
<%%= csrf_meta_tags %>
</head>
@@ -13,7 +13,7 @@
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line.
- Bundler.require(*Rails.groups(:assets => %w(development test)))
+ Bundler.require(*Rails.groups(assets: %w(development test)))
# If you want your assets lazily compiled in production, use this line.
# Bundler.require(:default, :assets, Rails.env)
end
@@ -1,18 +1,18 @@
<%= app_const %>.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
-
+
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
- # root :to => 'welcome#index'
+ # root to: 'welcome#index'
# Sample of regular route:
# get 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
- # get 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
+ # This route can be invoked with purchase_url(id: product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
@@ -39,7 +39,7 @@
# resources :products do
# resources :comments
# resources :sales do
- # get 'recent', :on => :collection
+ # get 'recent', on: :collection
# end
# end
@@ -52,4 +52,4 @@
# See how all your routes lay out with "rake routes"
-end
+end
@@ -3,8 +3,8 @@
class BrowsingTest < ActionDispatch::PerformanceTest
# Refer to the documentation for all available options
- # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory],
- # :output => 'tmp/performance', :formats => [:flat] }
+ # self.profile_options = { runs: 5, metrics: [:wall_time, :memory],
+ # output: 'tmp/performance', formats: [:flat] }
def test_homepage
get '/'
@@ -69,11 +69,11 @@ def teardown
Rails.env = "development"
assert_equal [:default, "development"], Rails.groups
- assert_equal [:default, "development", :assets], Rails.groups(:assets => [:development])
- assert_equal [:default, "development", :another, :assets], Rails.groups(:another, :assets => %w(development))
+ assert_equal [:default, "development", :assets], Rails.groups(assets: [:development])
+ assert_equal [:default, "development", :another, :assets], Rails.groups(:another, assets: %w(development))
Rails.env = "test"
- assert_equal [:default, "test"], Rails.groups(:assets => [:development])
+ assert_equal [:default, "test"], Rails.groups(assets: [:development])
ENV["RAILS_GROUPS"] = "javascripts,stylesheets"
assert_equal [:default, "test", "javascripts", "stylesheets"], Rails.groups
@@ -567,7 +567,7 @@ def self.attribute_names
app_file 'app/controllers/application_controller.rb', <<-RUBY
class ApplicationController < ActionController::Base
- protect_from_forgery :with => :reset_session # as we are testing API here
+ protect_from_forgery with: :reset_session # as we are testing API here
end
RUBY

0 comments on commit 1327660

Please sign in to comment.