diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index ab9eaba..122d986 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -52,6 +52,6 @@ class AccountsController < ApplicationController
end
def account_params
- params.require(:account).permit(:username, :password, :home, :site)
+ params.require(:account).permit(:username, :password, :home_folder, :contact_email)
end
end
diff --git a/app/models/account.rb b/app/models/account.rb
index 72f65ff..ee10b05 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -4,6 +4,6 @@ class Account < ApplicationRecord
validates :username, presence: true
validates :password, presence: true
- validates :home, presence: true
- validates :site, presence: true
+ validates :home_folder, presence: true
+ validates :contact_email, presence: true
end
diff --git a/app/views/accounts/_account.json.jbuilder b/app/views/accounts/_account.json.jbuilder
index c44ac72..e409065 100644
--- a/app/views/accounts/_account.json.jbuilder
+++ b/app/views/accounts/_account.json.jbuilder
@@ -1,3 +1,3 @@
# frozen_string_literal: true
-json.extract! account, :id, :username, :password, :home, :site, :created_at, :updated_at
+json.extract! account, :id, :username, :password, :home_folder, :contact_email, :created_at, :updated_at
json.url account_url(account, format: :json)
diff --git a/app/views/accounts/_form.html.erb b/app/views/accounts/_form.html.erb
index ea9bf64..8e27f63 100644
--- a/app/views/accounts/_form.html.erb
+++ b/app/views/accounts/_form.html.erb
@@ -22,13 +22,13 @@
- <%= f.label :home %>
- <%= f.text_field :home %>
+ <%= f.label :home_folder %>
+ <%= f.text_field :home_folder %>
- <%= f.label :site %>
- <%= f.text_field :site %>
+ <%= f.label :contact_email %>
+ <%= f.text_field :contact_email %>
diff --git a/app/views/accounts/index.html.erb b/app/views/accounts/index.html.erb
index 7cf0e48..4c8bd2a 100644
--- a/app/views/accounts/index.html.erb
+++ b/app/views/accounts/index.html.erb
@@ -5,10 +5,10 @@
+ Home Folder |
Username |
Password |
- Site |
- Home |
+ Contact eMail |
|
@@ -16,6 +16,7 @@
<% @accounts.each do |account| %>
+ <%= account.home_folder %> |
<%= account.username %> |
<%= link_to reveal_password_path(account.id), remote: true do %>
@@ -23,8 +24,7 @@
<% end %>
********
|
- <%= account.site %> |
- <%= account.home %> |
+ <%= account.contact_email %> |
<%= link_to 'Show', account %> |
<%= link_to 'Edit', edit_account_path(account) %> |
diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb
index 4583084..6d3a65f 100644
--- a/app/views/accounts/show.html.erb
+++ b/app/views/accounts/show.html.erb
@@ -16,13 +16,13 @@
- Home:
- <%= @account.home %>
+ Home Folder:
+ <%= @account.home_folder %>
- Site:
- <%= @account.site %>
+ Contact Email:
+ <%= @account.contact_email %>
<%= link_to 'Destroy', @account, method: :delete, data: { confirm: 'Are you sure?' } %>
diff --git a/db/migrate/20160828022337_create_accounts.rb b/db/migrate/20160828022337_create_accounts.rb
index 7252dd0..768e547 100644
--- a/db/migrate/20160828022337_create_accounts.rb
+++ b/db/migrate/20160828022337_create_accounts.rb
@@ -2,11 +2,10 @@
class CreateAccounts < ActiveRecord::Migration[5.0]
def change
create_table :accounts do |t|
- t.string :username
- t.string :password
- t.string :home
- t.string :site
-
+ t.string :username, null: false
+ t.string :password, null: false
+ t.string :home_folder, null: false
+ t.string :contact_email, null: false
t.timestamps
end
add_index :accounts, :username, unique: true
diff --git a/db/schema.rb b/db/schema.rb
index 7862e82..f8a6461 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,15 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20160828022337) do
+ActiveRecord::Schema.define(version: 20160929022453) do
create_table "accounts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
- t.string "username"
- t.string "password"
- t.string "home"
- t.string "site"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.string "username", null: false
+ t.string "password", null: false
+ t.string "home_folder"
+ t.string "contact_email", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.index ["username"], name: "index_accounts_on_username", unique: true, using: :btree
end
diff --git a/test/controllers/accounts_controller/edit_test.rb b/test/controllers/accounts_controller/edit_test.rb
index 27df294..ba9d86a 100644
--- a/test/controllers/accounts_controller/edit_test.rb
+++ b/test/controllers/accounts_controller/edit_test.rb
@@ -12,9 +12,9 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
test "should create account" do
assert_difference('Account.count') do
post accounts_url, params: { account: {
- home: @account.home,
+ home_folder: @account.home_folder,
password: @account.password,
- site: @account.site,
+ contact_email: @account.contact_email,
username: 'client-new'
} }
end
@@ -36,9 +36,9 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
test "should update account" do
patch account_url(@account), params: { account: {
- home: @account.home,
+ home_folder: @account.home_folder,
password: @account.password,
- site: @account.site,
+ contact_email: @account.contact_email,
username: @account.username
} }
assert_redirected_to account_url(@account)
diff --git a/test/fixtures/accounts.yml b/test/fixtures/accounts.yml
index 42981f4..ded4486 100644
--- a/test/fixtures/accounts.yml
+++ b/test/fixtures/accounts.yml
@@ -3,5 +3,5 @@
account1:
username: client-one
password: <%= CryptSerializer.dump('1q2w3e4r5t6y7u') %>
- home: client_one
- site: dev
+ home_folder: client_one
+ contact_email: ftp-user@mailinator.com
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 1899563..b18749f 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -20,7 +20,7 @@ WebMock.disable_net_connect!(allow_localhost: true)
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(color: true)]
class ActiveSupport::TestCase
- ActiveRecord::Migration.check_pending!
+ ActiveRecord::Migration.maintain_test_schema!
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all