Complete Lesson 6

main
Simon Quigley 1 year ago
parent 94f206d991
commit 9b03bbd714

@ -5,7 +5,9 @@
<ul>
<% @movies.each do |movie| %>
<li><%= movie.title %> (<%= movie.rating %>): <%= number_to_currency(movie.total_gross, precision: 0) %></li>
<li><%= movie.title %> (<%= movie.rating %>, <%= movie.released_on %>): <%= number_to_currency(movie.total_gross, precision: 0) %>
<br /><i><%= movie.description %></i>
</li>
<% end %>
</ul>
</div>

@ -0,0 +1,6 @@
class AddFieldsToMovies < ActiveRecord::Migration[7.0]
def change
add_column :movies, :description, :text
add_column :movies, :released_on, :date
end
end

4
db/schema.rb generated

@ -10,13 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_09_25_181424) do
ActiveRecord::Schema[7.0].define(version: 2023_09_25_183426) do
create_table "movies", force: :cascade do |t|
t.string "title"
t.string "rating"
t.decimal "total_gross"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "description"
t.date "released_on"
end
end

Loading…
Cancel
Save