Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

omg turbo based on params.

Pass turbo=true to turn on turbolinks
  • Loading branch information...
commit b7deaf3ea5b2f9c47d29b7ca2bb51505780722ce 1 parent f288c1d
@steveklabnik authored
View
8 app/controllers/pages_controller.rb
@@ -2,5 +2,13 @@ class PagesController < ApplicationController
def show
@id = params[:id]
@next_id = @id.to_i + 1
+
+ if params[:turbo]
+ @link_opts = {}
+ @url_opts = {:turbo => true}
+ else
+ @url_opts = {}
+ @link_opts = { :"data-no-turbolink" => true}
+ end
end
end
View
2  app/views/pages/show.html.erb
@@ -1,3 +1,3 @@
<h1>Page <%= @id %></h1>
-<p>Here's a link: <%= link_to "next", "/pages/#@next_id" %></p>
+<p>Here's a link: <%= link_to "next", page_path(@next_id, @url_opts), @link_opts %></p>
View
16 db/schema.rb
@@ -0,0 +1,16 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 0) do
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.