Skip to content

Commit 05372c8

Browse files
authored
[PR-8978] Fixed install generator (#18)
And Updated fixtures to match corresponding files from a fresh Rails 5.2 project.
1 parent 215e7b2 commit 05372c8

File tree

6 files changed

+19
-20
lines changed

6 files changed

+19
-20
lines changed

lib/talkable/generators/install_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def add_initializer
1717
end
1818

1919
def inject_talkable_offer
20-
inject_into_file "app/controllers/application_controller.rb", after: "protect_from_forgery with: :exception" do
20+
inject_into_file "app/controllers/application_controller.rb", after: "class ApplicationController < ActionController::Base" do
2121
<<-RUBY
2222
2323
before_action :load_talkable_offer
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<title>Page Title</title>
5-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7-
<%= csrf_meta_tags %>
8-
</head>
9-
<body>
3+
<head>
4+
<title>Page Title</title>
5+
<%= csrf_meta_tags %>
6+
<%= csp_meta_tag %>
107

11-
<%= yield %>
8+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
10+
</head>
1211

13-
</body>
12+
<body>
13+
<%= yield %>
14+
</body>
1415
</html>

spec/fixtures/files/application.html.haml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
%html
33
%head
44
%title Page Title
5-
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
6-
= javascript_include_tag 'application', 'data-turbolinks-track' => true
75
= csrf_meta_tags
6+
= csp_meta_tag
7+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload'
8+
= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload'
89
%body
910
= yield

spec/fixtures/files/application.html.slim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ html
33
head
44
title
55
| Page Title
6-
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
7-
= javascript_include_tag 'application', 'data-turbolinks-track' => true
86
= csrf_meta_tags
7+
= csp_meta_tag
8+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload'
9+
= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload'
10+
911
body
1012
= yield
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
class ApplicationController < ActionController::Base
2-
# Prevent CSRF attacks by raising an exception.
3-
# For APIs, you may want to use :null_session instead.
4-
protect_from_forgery with: :exception
5-
62
end

spec/fixtures/files/routes.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
Rails.application.routes.draw do
2-
# You can have the root of your site routed with "root"
3-
root 'welcome#index'
2+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
43
end

0 commit comments

Comments
 (0)