goals do
goal "Show the jobs!"
goal "Learn about ERB"
end
message <<-MARKDOWN
Going back to the jobs index (<http://localhost:3000/jobs>), we expect to see the list of all jobs. Let's actually build the job board part of this job board now!
MARKDOWN
steps do
step "read the jobs in the console" do
message <<-MARKDOWN
Before we show the jobs, let's actually look at what that is doing. Go back to your Rails console and run `Job.all`.
MARKDOWN
discussion_box "Rails Console", <<-MARKDOWN
The Rails console is super fun! It's giving us direct access to our local database.
* Try running `Job.all.to_sql`. What does that do?
* Try selecting an individual Job record.
* Try updating that individual record from the console!
MARKDOWN
end
step "read the jobs in the controller" do
message " If we're going to show our jobs in view, first we have to get them out of the database and store them in an instance variable."
source_code_with_message "Update the index method in the JobsController to look like this", :ruby,
<<-RUBY
def index
@jobs = Job.all
end
RUBY
end
step "show the jobs in the view" do
source_code_with_message "Add this to app/views/jobs/index.html.erb:", :erb,
<<-RUBY
<% @jobs.each do |job| %>
<h3><%= job.title %></h3>
<p><%= job.description %></p>
<% end %>
RUBY
discussion_box "ERB", <<-MARKDOWN
What is this doing? Go through this line by line, having one person explain each line.
Compare the ERB to the HTML that shows up on the page. ("Inspect Element" is your friend!)
What's the difference between a line with `<% %>` brackets and `<%= %>` brackets?
MARKDOWN
end
end
commitnow
next_step "add_a_navbar"