Skip to content

Commit 3e334bf

Browse files
Merge pull request #1 from danieldanilov/retroactive-learnings
Retroactive learnings: change "created at" to "learned on" and also update localhost to use port 8000 to avoid conflicts
2 parents a6d5372 + c94014a commit 3e334bf

File tree

14 files changed

+65
-28
lines changed

14 files changed

+65
-28
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ jobs:
2222
- name: Scan for common Rails security vulnerabilities using static analysis
2323
run: bin/brakeman --no-pager
2424

25-
scan_js:
26-
runs-on: ubuntu-latest
27-
28-
steps:
29-
- name: Checkout code
30-
uses: actions/checkout@v4
31-
32-
- name: Set up Ruby
33-
uses: ruby/setup-ruby@v1
34-
with:
35-
ruby-version: .ruby-version
36-
bundler-cache: true
37-
38-
- name: Scan for security vulnerabilities in JavaScript dependencies
39-
run: bin/importmap audit
40-
4125
lint:
4226
runs-on: ubuntu-latest
4327
steps:
@@ -51,5 +35,5 @@ jobs:
5135
bundler-cache: true
5236

5337
- name: Lint code for consistent style
54-
run: bin/rubocop -f github
38+
run: bundle exec rubocop
5539

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ group :development, :test do
4949
gem "brakeman", require: false
5050

5151
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
52-
# gem "rubocop-rails-omakase", require: false
52+
gem "rubocop-rails-omakase", require: false
5353
end
5454

5555
group :development do

Gemfile.lock

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ GEM
7272
securerandom (>= 0.3)
7373
tzinfo (~> 2.0, >= 2.0.5)
7474
uri (>= 0.13.1)
75+
ast (2.4.3)
7576
base64 (0.2.0)
7677
benchmark (0.4.0)
7778
bigdecimal (3.1.9)
@@ -104,6 +105,9 @@ GEM
104105
pp (>= 0.6.0)
105106
rdoc (>= 4.0.0)
106107
reline (>= 0.4.2)
108+
json (2.10.2)
109+
language_server-protocol (3.17.0.4)
110+
lint_roller (1.1.0)
107111
logger (1.7.0)
108112
loofah (2.24.0)
109113
crass (~> 1.0.2)
@@ -143,10 +147,15 @@ GEM
143147
racc (~> 1.4)
144148
nokogiri (1.18.7-x86_64-linux-musl)
145149
racc (~> 1.4)
150+
parallel (1.26.3)
151+
parser (3.3.7.4)
152+
ast (~> 2.4.1)
153+
racc
146154
pg (1.5.9)
147155
pp (0.6.2)
148156
prettyprint
149157
prettyprint (0.2.0)
158+
prism (1.4.0)
150159
propshaft (1.1.0)
151160
actionpack (>= 7.0.0)
152161
activesupport (>= 7.0.0)
@@ -195,9 +204,11 @@ GEM
195204
rake (>= 12.2)
196205
thor (~> 1.0, >= 1.2.2)
197206
zeitwerk (~> 2.6)
207+
rainbow (3.1.1)
198208
rake (13.2.1)
199209
rdoc (6.13.1)
200210
psych (>= 4.0.0)
211+
regexp_parser (2.10.0)
201212
reline (0.6.1)
202213
io-console (~> 0.5)
203214
rspec-core (3.13.3)
@@ -217,6 +228,35 @@ GEM
217228
rspec-mocks (~> 3.13)
218229
rspec-support (~> 3.13)
219230
rspec-support (3.13.2)
231+
rubocop (1.75.2)
232+
json (~> 2.3)
233+
language_server-protocol (~> 3.17.0.2)
234+
lint_roller (~> 1.1.0)
235+
parallel (~> 1.10)
236+
parser (>= 3.3.0.2)
237+
rainbow (>= 2.2.2, < 4.0)
238+
regexp_parser (>= 2.9.3, < 3.0)
239+
rubocop-ast (>= 1.44.0, < 2.0)
240+
ruby-progressbar (~> 1.7)
241+
unicode-display_width (>= 2.4.0, < 4.0)
242+
rubocop-ast (1.44.1)
243+
parser (>= 3.3.7.2)
244+
prism (~> 1.4)
245+
rubocop-performance (1.25.0)
246+
lint_roller (~> 1.1)
247+
rubocop (>= 1.75.0, < 2.0)
248+
rubocop-ast (>= 1.38.0, < 2.0)
249+
rubocop-rails (2.31.0)
250+
activesupport (>= 4.2.0)
251+
lint_roller (~> 1.1)
252+
rack (>= 1.1)
253+
rubocop (>= 1.75.0, < 2.0)
254+
rubocop-ast (>= 1.38.0, < 2.0)
255+
rubocop-rails-omakase (1.1.0)
256+
rubocop (>= 1.72)
257+
rubocop-performance (>= 1.24)
258+
rubocop-rails (>= 2.30)
259+
ruby-progressbar (1.13.0)
220260
securerandom (0.4.1)
221261
solid_cache (1.0.7)
222262
activejob (>= 7.2)
@@ -237,6 +277,9 @@ GEM
237277
railties (>= 7.1.0)
238278
tzinfo (2.0.6)
239279
concurrent-ruby (~> 1.0)
280+
unicode-display_width (3.1.4)
281+
unicode-emoji (~> 4.0, >= 4.0.4)
282+
unicode-emoji (4.0.4)
240283
uri (1.0.3)
241284
useragent (0.16.11)
242285
web-console (4.2.1)
@@ -272,6 +315,7 @@ DEPENDENCIES
272315
puma (>= 5.0)
273316
rails (~> 8.0.2)
274317
rspec-rails (>= 6.0)
318+
rubocop-rails-omakase
275319
solid_cache
276320
stimulus-rails
277321
thruster

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ It also serves as a self-referential job application, demonstrating core Rails s
4343
```bash
4444
rbenv exec bin/dev
4545
```
46-
Visit `http://localhost:3000` in your browser.
46+
Visit `http://localhost:8000` in your browser.
4747

4848
## Running Tests
4949

app/controllers/learnings_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class LearningsController < ApplicationController
22
def index
3-
@learnings = Learning.order(created_at: :desc)
3+
@learnings = Learning.order(learned_on: :desc)
44
end
55

66
def new
@@ -32,6 +32,6 @@ def destroy_multiple
3232
private
3333

3434
def learning_params
35-
params.require(:learning).permit(:title, :body, :tags)
35+
params.require(:learning).permit(:title, :body, :tags, :learned_on)
3636
end
3737
end

app/views/learnings/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<% if learning.tags.present? %>
1919
<p><strong>Tags:</strong> <%= learning.tags %></p>
2020
<% end %>
21-
<small>Logged on: <%= learning.created_at.strftime("%B %d, %Y") %></small>
21+
<small>Learned on: <%= learning.learned_on.strftime("%B %d, %Y") %></small>
2222
</div>
2323
</label>
2424
<% end %>

app/views/learnings/new.html.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
<%= form.text_area :body, rows: 5 %>
2323
</div>
2424

25+
<div>
26+
<%= form.label :learned_on, "Learned On" %><br>
27+
<%= form.date_field :learned_on, value: Date.today %>
28+
</div>
29+
2530
<div>
2631
<%= form.label :tags, "Tags (comma-separated)" %><br>
2732
<%= form.text_field :tags %>

config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
config.action_mailer.perform_caching = false
3939

4040
# Set localhost to be used by links generated in mailer templates.
41-
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
41+
config.action_mailer.default_url_options = { host: "localhost", port: 8000 }
4242

4343
# Print deprecation notices to the Rails logger.
4444
config.active_support.deprecation = :log

config/puma.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
threads threads_count, threads_count
2929

3030
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
31-
port ENV.fetch("PORT", 3000)
31+
port ENV.fetch("PORT", 8000)
3232

3333
# Allow puma to be restarted by `bin/rails restart` command.
3434
plugin :tmp_restart

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
get "about", to: "static_pages#about"
1414

1515
# Learning Resources (only index, new, create)
16-
resources :learnings, only: [:index, :new, :create] do
16+
resources :learnings, only: [ :index, :new, :create ] do
1717
delete :destroy_multiple, on: :collection
1818
end
1919

0 commit comments

Comments
 (0)