Skip to content

Instantly share code, notes, and snippets.

@znz
Created November 5, 2008 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save znz/22318 to your computer and use it in GitHub Desktop.
Save znz/22318 to your computer and use it in GitHub Desktop.
diff -r 23aa8d1c4bcf -r d7daa8217d67 app/controllers/hoge_controller.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controllers/hoge_controller.rb Wed Nov 05 20:09:58 2008 +0900
@@ -0,0 +1,10 @@
+class HogeController < ApplicationController
+ session :off
+
+ def index
+ end
+
+ def sample
+ end
+
+end
diff -r 23aa8d1c4bcf -r d7daa8217d67 app/helpers/hoge_helper.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/helpers/hoge_helper.rb Wed Nov 05 20:09:58 2008 +0900
@@ -0,0 +1,2 @@
+module HogeHelper
+end
diff -r 23aa8d1c4bcf -r d7daa8217d67 app/views/hoge/index.html.erb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/hoge/index.html.erb Wed Nov 05 20:09:58 2008 +0900
@@ -0,0 +1,25 @@
+<h1>Hoge#index</h1>
+<p>Find me in app/views/hoge/index.html.erb</p>
+
+<%# sample from http://www.s2factory.co.jp/tech/prototype/prototype.js.html %>
+<script>
+ function getHTML(url)
+ {
+ var myAjax = new Ajax.Updater(
+ {success: 'placeholder'},
+ url,
+ {
+ method: 'get',
+ onFailure: reportError
+ });
+ }
+
+ function reportError(request)
+ {
+ alert('Sorry. There was an error.');
+ }
+</script>
+
+<input type="button" value="Get Sample" onclick="getHTML('<%= url_for :action => "sample" %>')" />
+<input type="button" value="Get Sample Html" onclick="getHTML('<%= url_for :action => "sample", :format => "html" %>')" />
+<div id="placeholder"></div>
diff -r 23aa8d1c4bcf -r d7daa8217d67 app/views/hoge/sample.html.erb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/hoge/sample.html.erb Wed Nov 05 20:09:58 2008 +0900
@@ -0,0 +1,2 @@
+<h1>Hoge#sample</h1>
+<p>Find me in app/views/hoge/sample.html.erb</p>
diff -r 23aa8d1c4bcf -r d7daa8217d67 app/views/layouts/application.html.erb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/layouts/application.html.erb Wed Nov 05 20:09:58 2008 +0900
@@ -0,0 +1,17 @@
+<%- unless request.xhr? -%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<% lang = 'ja' %>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= lang %>" lang="<%= lang %>">
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+ <title><%= @title || controller.action_name %></title>
+ <%= javascript_include_tag :defaults %>
+</head>
+<body>
+<%- end -%>
+application:
+<%= yield %>
+
+</body>
+</html>
diff -r 23aa8d1c4bcf -r d7daa8217d67 config/environment.rb
--- a/config/environment.rb Wed Nov 05 20:09:19 2008 +0900
+++ b/config/environment.rb Wed Nov 05 20:09:58 2008 +0900
@@ -18,7 +18,7 @@ Rails::Initializer.run do |config|
# Skip frameworks you're not going to use. To use Rails without a database
# you must remove the Active Record framework.
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
+ config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
# Specify gems that this application depends on.
# They can then be installed with "rake gems:install" on new installations.
diff -r 23aa8d1c4bcf -r d7daa8217d67 config/routes.rb
--- a/config/routes.rb Wed Nov 05 20:09:19 2008 +0900
+++ b/config/routes.rb Wed Nov 05 20:09:58 2008 +0900
@@ -32,6 +32,7 @@ ActionController::Routing::Routes.draw d
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"
+ map.root :controller => "hoge"
# See how all your routes lay out with "rake routes"
diff -r 23aa8d1c4bcf -r d7daa8217d67 test/functional/hoge_controller_test.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/functional/hoge_controller_test.rb Wed Nov 05 20:09:58 2008 +0900
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class HogeControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ def test_truth
+ assert true
+ end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment