Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Completed exercises in Chapter 4

  • Loading branch information...
commit ba0962aa585a5a40ac88c0fc5d2b4935b0005b8c 1 parent 162b807
@jam1401 authored
View
1  .idea/dataSources.ids
@@ -0,0 +1 @@
+<?xml version='1.0' encoding='UTF-8' ?><component name="dataSourceStorage"><data-source source="LOCAL" name="Rails sample_app: development" product="" version="" jdbc-version="" driver-name="" driver-version="" uuid="50481bcd-8446-4af6-b161-7382bee477b6"><jdbc-driver>org.sqlite.JDBC</jdbc-driver><jdbc-url>jdbc:sqlite:/Users/jeffreymorgan/Documents/work/sample_app/db/development.sqlite3</jdbc-url><libraries><library><url>file://$USER_HOME$/Library/Preferences/RubyMine40/jdbc-drivers/xerial-sqlite-license.txt</url></library><library><url>jar://$USER_HOME$/Library/Preferences/RubyMine40/jdbc-drivers/sqlite-jdbc-3.7.2.jar!/</url></library></libraries></data-source><data-source source="LOCAL" name="Rails sample_app: test" product="" version="" jdbc-version="" driver-name="" driver-version="" uuid="a68acf7c-e26a-4d3b-95d1-cbba3d870be5"><jdbc-driver>org.sqlite.JDBC</jdbc-driver><jdbc-url>jdbc:sqlite:/Users/jeffreymorgan/Documents/work/sample_app/db/test.sqlite3</jdbc-url><libraries><library><url>file://$USER_HOME$/Library/Preferences/RubyMine40/jdbc-drivers/xerial-sqlite-license.txt</url></library><library><url>jar://$USER_HOME$/Library/Preferences/RubyMine40/jdbc-drivers/sqlite-jdbc-3.7.2.jar!/</url></library></libraries></data-source></component>
View
5 .idea/dataSources.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DataSourceManagerImpl" compressed="false" hash="406289524" />
+</project>
+
View
163 .idea/workspace.xml
@@ -22,73 +22,73 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="pages_helper.rb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/helpers/pages_helper.rb">
+ <file leaf-file-name="pages_controller.rb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/controllers/pages_controller.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <state line="14" column="18" selection-start="196" selection-end="196" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="layout_links_spec.rb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/spec/requests/layout_links_spec.rb">
+ <file leaf-file-name="pages_controller_spec.rb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/spec/controllers/pages_controller_spec.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="63" selection-start="712" selection-end="712" vertical-scroll-proportion="0.0">
+ <state line="22" column="14" selection-start="464" selection-end="464" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="pages_controller.rb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/controllers/pages_controller.rb">
+ <file leaf-file-name="_stylesheets.html.erb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/_stylesheets.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="14" column="18" selection-start="196" selection-end="196" vertical-scroll-proportion="0.0">
+ <state line="6" column="112" selection-start="364" selection-end="364" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="routes.rb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/config/routes.rb">
+ <file leaf-file-name="_footer.html.erb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/_footer.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="26" selection-start="84" selection-end="84" vertical-scroll-proportion="0.0">
+ <state line="4" column="45" selection-start="135" selection-end="135" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="home.html.erb" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/app/views/pages/home.html.erb">
+ <file leaf-file-name="users_helper.rb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/helpers/users_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="8" column="43" selection-start="212" selection-end="212" vertical-scroll-proportion="0.11846002">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="_footer.html.erb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/views/layouts/_footer.html.erb">
+ <file leaf-file-name="application_helper.rb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/helpers/application_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="45" selection-start="135" selection-end="135" vertical-scroll-proportion="-2.5">
+ <state line="4" column="5" selection-start="77" selection-end="77" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="users_helper.rb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/helpers/users_helper.rb">
+ <file leaf-file-name="_header.html.erb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/_header.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <state line="0" column="8" selection-start="8" selection-end="8" vertical-scroll-proportion="-0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="application_helper.rb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/helpers/application_helper.rb">
+ <file leaf-file-name="layout_links_spec.rb" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/spec/requests/layout_links_spec.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="11" column="201" selection-start="226" selection-end="226" vertical-scroll-proportion="0.0">
+ <state line="40" column="63" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.7712082">
<folding />
</state>
</provider>
@@ -127,25 +127,25 @@
<option value="$PROJECT_DIR$/app/controllers/pages_controller.rb" />
<option value="$PROJECT_DIR$/app/views/pages/help.html.erb" />
<option value="$PROJECT_DIR$/spec/controllers/pages_controller_spec.rb" />
- <option value="$PROJECT_DIR$/app/helpers/application_helper.rb" />
<option value="$PROJECT_DIR$/app/views/layouts/_stylesheets.html.erb" />
<option value="$PROJECT_DIR$/app/views/layouts/application.html.erb" />
<option value="$PROJECT_DIR$/app/assets/stylesheets/custom.css" />
- <option value="$PROJECT_DIR$/app/views/layouts/_header.html.erb" />
<option value="$PROJECT_DIR$/app/views/layouts/_footer.html.erb" />
<option value="$PROJECT_DIR$/spec/controllers/users_controller_spec.rb" />
<option value="$PROJECT_DIR$/app/controllers/users_controller.rb" />
- <option value="$PROJECT_DIR$/spec/requests/layout_links_spec.rb" />
<option value="$PROJECT_DIR$/config/routes.rb" />
<option value="$PROJECT_DIR$/app/views/pages/home.html.erb" />
+ <option value="$PROJECT_DIR$/app/helpers/application_helper.rb" />
+ <option value="$PROJECT_DIR$/app/views/layouts/_header.html.erb" />
+ <option value="$PROJECT_DIR$/spec/requests/layout_links_spec.rb" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
- <option name="x" value="264" />
- <option name="y" value="-1398" />
- <option name="width" value="2058" />
- <option name="height" value="1181" />
+ <option name="x" value="-62" />
+ <option name="y" value="-1440" />
+ <option name="width" value="2327" />
+ <option name="height" value="1329" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
@@ -183,6 +183,16 @@
</PATH>
</subPane>
</pane>
+ <pane id="RailsProjectView">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sample_app" />
+ <option name="myItemType" value="org.jetbrains.plugins.ruby.rails.projectView.v2.nodes.RailsProjectNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -415,12 +425,17 @@
</PATH>
</subPane>
</pane>
- <pane id="RailsProjectView" />
</panes>
</component>
<component name="PropertiesComponent">
+ <property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="recentsLimit" value="5" />
+ <property name="options.lastSelected" value="org.jetbrains.plugins.ruby.settings.RubyIdeSdkConfigurable" />
+ <property name="FullScreen" value="false" />
+ <property name="GoToClass.includeJavaFiles" value="false" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ <property name="options.searchVisible" value="true" />
</component>
<component name="RunManager" selected="Rails.Development: sample_app">
<configuration default="true" type="RakeRunConfigurationType" factoryName="Rake">
@@ -599,17 +614,17 @@
<servers />
</component>
<component name="ToolWindowManager">
- <frame x="264" y="-1398" width="2058" height="1181" extended-state="0" />
+ <frame x="-62" y="-1440" width="2327" height="1329" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25273633" sideWeight="0.6703499" order="0" side_tool="false" content_ui="combo" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.26371217" sideWeight="0.6701783" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
- <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3298217" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
@@ -676,112 +691,92 @@
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/app/views/pages/help.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="5" column="37" selection-start="137" selection-end="137" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="5" column="37" selection-start="137" selection-end="137" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/spec/controllers/pages_controller_spec.rb">
+ <entry file="file://$PROJECT_DIR$/app/assets/stylesheets/custom.css">
<provider selected="true" editor-type-id="text-editor">
- <state line="42" column="202" selection-start="961" selection-end="961" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="66" column="21" selection-start="714" selection-end="714" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/assets/stylesheets/custom.css">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="66" column="21" selection-start="714" selection-end="714" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="13" column="202" selection-start="281" selection-end="281" vertical-scroll-proportion="-8.125" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/layouts/_stylesheets.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/helpers/pages_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="6" column="55" selection-start="364" selection-end="364" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
+ <entry file="file://$PROJECT_DIR$/config/routes.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="13" column="202" selection-start="281" selection-end="281" vertical-scroll-proportion="-8.125">
- <folding />
- </state>
+ <state line="4" column="26" selection-start="84" selection-end="84" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/layouts/_header.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/pages/home.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="6" column="41" selection-start="240" selection-end="240" vertical-scroll-proportion="-3.75">
+ <state line="8" column="29" selection-start="198" selection-end="198" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/layouts/_footer.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="45" selection-start="135" selection-end="135" vertical-scroll-proportion="-2.5">
- <folding />
- </state>
+ <state line="4" column="45" selection-start="135" selection-end="135" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/users_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/helpers/pages_helper.rb">
+ <entry file="file://$PROJECT_DIR$/spec/controllers/users_controller_spec.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="18" column="55" selection-start="327" selection-end="327" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/helpers/application_helper.rb">
+ <entry file="file://$PROJECT_DIR$/app/controllers/users_controller.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="11" column="201" selection-start="226" selection-end="226" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="2" column="21" selection-start="77" selection-end="77" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/controllers/pages_controller.rb">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/_stylesheets.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="14" column="18" selection-start="196" selection-end="196" vertical-scroll-proportion="0.0">
+ <state line="6" column="112" selection-start="364" selection-end="364" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/spec/controllers/users_controller_spec.rb">
+ <entry file="file://$PROJECT_DIR$/app/controllers/pages_controller.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="18" column="55" selection-start="327" selection-end="327" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="14" column="18" selection-start="196" selection-end="196" vertical-scroll-proportion="0.0" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/controllers/users_controller.rb">
+ <entry file="file://$PROJECT_DIR$/spec/controllers/pages_controller_spec.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="2" column="21" selection-start="77" selection-end="77" vertical-scroll-proportion="0.0">
+ <state line="22" column="14" selection-start="464" selection-end="464" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/spec/requests/layout_links_spec.rb">
+ <entry file="file://$PROJECT_DIR$/app/helpers/application_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="63" selection-start="712" selection-end="712" vertical-scroll-proportion="0.0">
+ <state line="4" column="5" selection-start="77" selection-end="77" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/config/routes.rb">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/_header.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="26" selection-start="84" selection-end="84" vertical-scroll-proportion="0.0">
+ <state line="0" column="8" selection-start="8" selection-end="8" vertical-scroll-proportion="-0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/pages/home.html.erb">
+ <entry file="file://$PROJECT_DIR$/spec/requests/layout_links_spec.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="8" column="43" selection-start="212" selection-end="212" vertical-scroll-proportion="0.11846002">
+ <state line="40" column="63" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.7712082">
<folding />
</state>
</provider>
View
5 app/helpers/application_helper.rb
@@ -1,4 +1,9 @@
module ApplicationHelper
+
+ # return a logo for use on pages
+ def logo
+ @logo = image_tag("logo.png", :alt => "Sample App", :class => "round")
+ end
# Return a title on a per-page basis
def title
base_title = "Ruby on Rails Tutorial Sample App"
View
1  app/views/layouts/_header.html.erb
@@ -1,5 +1,4 @@
<header>
- <% logo = image_tag("logo.png", :alt => "Sample App", :class => "round") %>
<%= link_to logo, root_path %>
<nav class="round">
<ul>
View
14 spec/requests/layout_links_spec.rb
@@ -27,4 +27,18 @@
response.should have_selector('title', :content => "Sign up")
end
+ it "should have the right links on the layout" do
+ visit root_path
+ click_link "About"
+ response.should have_selector('title', :content => "About")
+ click_link "Help"
+ response.should have_selector('title', :content => "Help")
+ click_link "Contact"
+ response.should have_selector('title', :content => "Contact")
+ click_link "Home"
+ response.should have_selector('title', :content => "Home")
+ click_link "Sign up Now!"
+ response.should have_selector('title', :content => "Sign up")
+ end
+
end
View
14 webrat.log
@@ -0,0 +1,14 @@
+# Logfile created on Wed Mar 14 10:52:15 -0700 2012 by logger.rb/22285
+REQUESTING PAGE: GET / with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/"}
+REQUESTING PAGE: GET / with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/"}
+REQUESTING PAGE: GET /help with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/help"}
+REQUESTING PAGE: GET / with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET / with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/"}
+REQUESTING PAGE: GET /help with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/help"}
+REQUESTING PAGE: GET / with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET /signup with {} and HTTP headers {"HTTP_REFERER"=>"/"}
Please sign in to comment.
Something went wrong with that request. Please try again.