Write detailed instructions on how to play a game of Battleship. Compose these instructions as if they were written for a computer interacting with a human.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
resources :photos do | |
member do | |
get 'edit_tags' | |
post 'edit_tags' | |
post 'update_tags' | |
end | |
collection do | |
get 'dashboard' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Edit Tags for <%= @photo.name %></h1> | |
<%= form_tag update_tags_photo_path do %> | |
<ul> | |
<% @tags.each do |t| %> | |
<li> | |
<%= check_box_tag "tags[#{t.id}]", true, @photo.tags.include?(t) %> | |
<%= t.name %> | |
</li> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PhotosController < ApplicationController | |
before_action :set_photo, only: [:show, :edit, :update, :destroy, :edit_tags, :update_tags] | |
# GET /photos | |
# GET /photos.json | |
def index | |
@photos = Photo.all | |
end | |
# GET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ItemsHelper | |
def display_array_contents(items) | |
result = "<table>" | |
items.each do |i| | |
result << "<tr>" | |
result << "<td>#{i.name}</td>" | |
result << "<td>#{i.price}</td>" | |
result << "</tr>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Shirt | |
def initialize(c) | |
@color = c | |
end | |
def number_of_arms | |
2 | |
end | |
def color |
NewerOlder