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
# 実行前に下の設定が必要です | |
# $ rbenv exec gem install heroku-api | |
# $ export HEROKU_API_KEY=your_heroku_api_key | |
require 'heroku-api' | |
heroku = Heroku::API.new | |
apps = heroku.get_apps.body | |
apps.each do |app| | |
puts app['name'] | |
collaborators = heroku.get_collaborators(app['name']).body |
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
- var height = 300 | |
- if (i % 3 == 1) | |
- height = 400 | |
- if (i % 3 == 2) | |
- height = 500 | |
- height = 300 |
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
Sample::Application.routes.draw do | |
resources :items | |
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
Prefix Verb URI Pattern Controller#Action | |
items GET /items(.:format) items#index | |
POST /items(.:format) items#create | |
new_item GET /items/new(.:format) items#new | |
edit_item GET /items/:id/edit(.:format) items#edit | |
item GET /items/:id(.:format) items#show | |
PATCH /items/:id(.:format) items#update | |
PUT /items/:id(.:format) items#update | |
DELETE /items/:id(.:format) items#destroy |
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 ItemsController < ApplicationController | |
before_action :set_item, only: [:show, :edit, :update, :destroy] | |
def index | |
@items = Item.all | |
end | |
def show | |
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 CreateItems < ActiveRecord::Migration | |
def change | |
create_table :items do |t| | |
t.string :name | |
t.integer :price | |
t.text :description | |
t.timestamps | |
end | |
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>Listing items</h1> | |
<table> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Price</th> | |
<th>Description</th> | |
<th></th> | |
<th></th> |
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
json.array!(@items) do |item| | |
json.extract! item, :name, :price, :description | |
json.url item_url(item, format: :json) | |
end |
OlderNewer