added route, controller, model, sidebar link, and basic index page for the work info section so that we can render user data

This commit is contained in:
Ken Johnson
2013-05-31 10:48:20 -04:00
parent a599ca9862
commit 08a8c60276
12 changed files with 66 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
class WorkInfoController < ApplicationController
def index
end
end
+2
View File
@@ -0,0 +1,2 @@
module WorkInfoHelper
end
+1
View File
@@ -12,6 +12,7 @@ class User < ActiveRecord::Base
before_save :assign_user_id, :on => :create before_save :assign_user_id, :on => :create
has_one :retirement, :foreign_key => :user_id, :primary_key => :user_id has_one :retirement, :foreign_key => :user_id, :primary_key => :user_id
has_one :paid_time_off, :foreign_key => :user_id, :primary_key => :user_id has_one :paid_time_off, :foreign_key => :user_id, :primary_key => :user_id
has_one :work_info, :foreign_key => :user_id, :primary_key => :user_id
+4
View File
@@ -0,0 +1,4 @@
class WorkInfo < ActiveRecord::Base
attr_accessible :DoB, :SSN, :bonuses, :income, :user_id, :years_worked
belongs_to :user
end
+2 -2
View File
@@ -43,12 +43,12 @@
<% end %> <% end %>
</li> </li>
<li> <li>
<a href="#"> <%= link_to user_work_info_index_path(:user_id => current_user.user_id) do %>
<div class="icon"> <div class="icon">
<span class="fs1" aria-hidden="true" data-icon="&#xe0a9;"></span> <span class="fs1" aria-hidden="true" data-icon="&#xe0a9;"></span>
</div> </div>
Work Info Work Info
</a> <% end %>
</li> </li>
<li> <li>
<a href="#"> <a href="#">
View File
+3
View File
@@ -16,6 +16,9 @@ resources :users do
resources :paid_time_off do resources :paid_time_off do
end end
resources :work_info do
end
end end
@@ -0,0 +1,14 @@
class CreateWorkInfos < ActiveRecord::Migration
def change
create_table :work_infos do |t|
t.integer :user_id
t.string :income
t.string :bonuses
t.integer :years_worked
t.string :SSN
t.date :DoB
t.timestamps
end
end
end
+17
View File
@@ -0,0 +1,17 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
user_id: 1
income: MyString
bonuses: MyString
years_worked: 1
SSN: MyString
DoB: 2013-05-31
two:
user_id: 1
income: MyString
bonuses: MyString
years_worked: 1
SSN: MyString
DoB: 2013-05-31
@@ -0,0 +1,7 @@
require 'test_helper'
class WorkInfoControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
@@ -0,0 +1,4 @@
require 'test_helper'
class WorkInfoHelperTest < ActionView::TestCase
end
+7
View File
@@ -0,0 +1,7 @@
require 'test_helper'
class WorkInfoTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end