Skip to content

Instantly share code, notes, and snippets.

View masonfmatthews's full-sized avatar

Mason F. Matthews masonfmatthews

  • Hillsborough, NC
View GitHub Profile
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
<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 %>
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
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
@masonfmatthews
masonfmatthews / battleship.md
Created January 12, 2015 19:22
Battleship Test

Battleship Instructions

Description

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.

Objectives

Learning Objectives

class Shirt
def initialize(c)
@color = c
end
def number_of_arms
2
end
def color