Skip to content

Commit 9cc2b13

Browse files
committed
Rails 5 updates for job board curriculum
* quiet_assets is no longer needed (though we contrivedly talk about `bundle install` anyway) * Different (worse?) errors for missing templates * ApplicationRecord instead of active record * Migrations have this version thing * `null: false` is missing from timestamps in migrations
1 parent e05a717 commit 9cc2b13

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

sites/en/job-board/create_a_rails_app.step

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ MARKDOWN
4343

4444
discussion_box "Text Editor vs Command Line", "Review the differences between the the command line and your text editor, even if everyone already knows!"
4545

46-
message "# Fix Up Those Defaults"
46+
message "# Let's Talk About Dependencies"
4747

48-
source_code_with_message "We're going to be looking at the Rails server output, which includes a lot of noise by default. Find the file called 'Gemfile' by searching for it, and add the following line:", :ruby, "gem 'quiet_assets'"
48+
message "When we created a new Rails app, it installed a bunch of stuff by default. The list of things Rails installed is in a file called `Gemfile`. If you want to add any additional third party code (aka **gems**), you can add more lines to the `Gemfile` and install them with `bundle`."
4949

50-
console_with_message "Save the file, and then in the command line, run the following command:", "bundle install"
50+
console_with_message "Rails has already installed all the stuff we need, but you can always run bundle again to re-install gems, or install gems newly added to the Gemfile. In the command line, run the following command:", "bundle install"
5151

5252
discussion_box "What does 'bundle' do?", <<-MARKDOWN
5353
Bundler is the tool the Ruby community uses for dependency management.

sites/en/job-board/job-board.step

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ message <<-MARKDOWN
1616
We're also going to skip deploying to Heroku this time around, but you can definitely use the instructions from the Suggestotron curriculum to deploy your app to the internet!
1717
MARKDOWN
1818

19-
important "This curriculum is written for Rails 4. Things will get awkward / broken if you're using Rails 3, so if you skipped the Installfest, you need to upgrade to Rails 4 now."
19+
important "This curriculum is written for Rails 5. Things will get awkward / broken if you're using an earlier version of Rails, so if you skipped the Installfest, you need to upgrade to Rails 5 now."
2020

2121
message <<-MARKDOWN
2222
# Tips for everyone:

sites/en/job-board/listing_the_jobs.step

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ MARKDOWN
3232

3333
message "# Show those jobs!"
3434

35-
source_code_with_message "Add this to app/views/jobs/index.html.erb:", :ruby,
35+
source_code_with_message "Add this to app/views/jobs/index.html.erb:", :erb,
3636
<<-RUBY
3737
<% @jobs.each do |job| %>
3838
<h3><%= job.title %></h3>

sites/en/job-board/make_a_jobs_home_page.step

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ MARKDOWN
3333
source_code_with_message "We're going to need a resource route, which will create EIGHT different routes for us. Add this to line two:", :ruby, "resources :jobs"
3434

3535
message <<-MARKDOWN
36-
Now, lets go look at what that made, by using the excellently helpful page available on any Rails 4 app: <http://localhost:3000/rails/info>.
36+
Now, lets go look at what that made, by using the excellently helpful routes page: <http://localhost:3000/rails/info>.
3737
MARKDOWN
3838

3939
discussion_box "How to read the routes page.", <<-MARKDOWN
@@ -49,8 +49,6 @@ discussion_box "How to read the routes page.", <<-MARKDOWN
4949
Can you find the line that will make `/jobs` a route?
5050
MARKDOWN
5151

52-
tip "If you are on Rails 3, going to /rails/info will **fail**! Stop right now and upgrade to Rails 4."
53-
5452
message <<-MARKDOWN
5553
Since adding the line `resources :jobs` made a route matching `/jobs`, let's go visit that page again: <http://localhost:3000/jobs>
5654
MARKDOWN
@@ -97,10 +95,10 @@ RUBY
9795

9896
message "And refresh <http://localhost:3000/jobs>"
9997

100-
error_box "Missing template jobs/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in: * '/Users/probablyyou/railsbridge/job_board/app/views'"
98+
error_box "JobsController#index is missing a template for this request format and variant."
10199

102100
message <<-MARKDOWN
103-
What's the important part of the this error? How does Rails decide to look for something called jobs/index? How did it decide to look in the views directory?
101+
What's a template? How does Rails decide to look for the template associated with JobsController's `index` action?
104102

105103
Talk through what Rails is trying, and failing, to do, and how file names and method names are important here.
106104

sites/en/job-board/make_the_form_work.step

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ source_code :ruby,
2424
end
2525
RUBY
2626

27-
message "Reload the page!"
27+
message "Try to use your form again. Unfortunately, there won't be any output, not even an error page. But if you look closely at the output from your Rails server, you might find this:"
2828

29-
error_box "Missing template jobs/create, application/create with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in: * '/Users/lillie/railsbridge/job_board/app/views'"
29+
error_box "No template found for JobsController#create, rendering head :no_content"
3030

3131
<<-MARKDOWN
3232
Familiar error, right? We don't have a template called create.html.erb.
@@ -78,7 +78,7 @@ source_code :http,
7878
JSON
7979

8080
message <<-MARKDOWN
81-
This is the precious data that our form is sending, and right now we're just throwing it away. Let's not do that! Since we're using Rails 4 and all its great conventions, we're going to use Strong Parameters to limit what kind of data our form can submit to our app.
81+
This is the precious data that our form is sending, and right now we're just throwing it away. Let's not do that! Since we're using Rails 5 and all its great conventions, we're going to use Strong Parameters to limit what kind of data our form can submit to our app.
8282
MARKDOWN
8383

8484
source_code_with_message "Add this code to your jobs controller. (Notice that we're expanding the create method. Don't just copy and paste and end up with two create methods, folks.)", :ruby,

sites/en/job-board/store_jobs_in_the_database.step

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ message <<-MARKDOWN
3535
MARKDOWN
3636

3737
source_code :ruby, <<-RUBY
38-
class CreateJobs < ActiveRecord::Migration
38+
class CreateJobs < ActiveRecord::Migration[5.0]
3939
def change
4040
create_table :jobs do |t|
4141

42-
t.timestamps null: false
42+
t.timestamps
4343
end
4444
end
4545
end
@@ -55,7 +55,7 @@ source_code :ruby, <<-RUBY
5555
create_table :jobs do |t|
5656
t.text :title
5757
t.text :description
58-
t.timestamps null: false
58+
t.timestamps
5959
end
6060
RUBY
6161

sites/en/job-board/update_job_listings.step

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ source_code_with_message "Say we want to edit the first job posting. If we look
1212

1313
message "So, it looks like if we want to edit the job description, we should visit this URL: <http://localhost:3000/jobs/1/edit>."
1414

15+
error_box "The action 'edit' could not be found for JobsController"
16+
1517
source_code_with_message "We've seen this before, right? Let's add the controller action:",
1618
<<-RUBY
1719
def edit

0 commit comments

Comments
 (0)