Skip to content

Commit

Permalink
generate basic controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
osaienko committed Sep 7, 2022
1 parent 59a2ae1 commit a5f43ea
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@
/yarn-error.log
yarn-debug.log*
.yarn-integrity

.idea
3 changes: 3 additions & 0 deletions app/assets/stylesheets/static_pages.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the static_pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
7 changes: 7 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class StaticPagesController < ApplicationController
def landing_page
end

def privacy_policy
end
end
2 changes: 2 additions & 0 deletions app/helpers/static_pages_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module StaticPagesHelper
end
2 changes: 2 additions & 0 deletions app/views/static_pages/landing_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Landing Page</h1>
<%=link_to "Privacy Policy", privacy_policy_path %>
2 changes: 2 additions & 0 deletions app/views/static_pages/privacy_policy.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Privacy Policy</h1>
<%=link_to "Home", root_path %>
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Rails.application.routes.draw do
root "static_pages#landing_page"
# get 'static_pages/privacy_policy'
get "privacy_policy", to: "static_pages#privacy_policy"
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
13 changes: 13 additions & 0 deletions test/controllers/static_pages_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "test_helper"

class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test "should get landing_page" do
get static_pages_landing_page_url
assert_response :success
end

test "should get privacy_policy" do
get static_pages_privacy_policy_url
assert_response :success
end
end

0 comments on commit a5f43ea

Please sign in to comment.