Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
DVD of Rails
Search
ogom
August 12, 2014
Programming
2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DVD of Rails
Detonation Velocity Development
ogom
August 12, 2014
More Decks by ogom
See All by ogom
PicoRuby から始めるたのしい電子工作
ogom
0
2.2k
GraphQL Better Errors
ogom
0
400
Osaka RubyKaigi 02
ogom
0
390
Osaka RubyKaigi 01
ogom
0
250
Contributing to GitLab with OSS Gate
ogom
0
650
DojoCon Japan 2017
ogom
0
170
GDStudy Engage
ogom
1
830
Using Immutable.js with React Redux
ogom
0
190
CoderDojo と オープンソース
ogom
2
540
Other Decks in Programming
See All in Programming
不幸な GC
chencmd
0
890
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
3
370
AIの中の人になってみる
htkym
0
170
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
110
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
410
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
580
Press start. Python's next generation.
willingc
PRO
3
320
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
フロントエンドUIフレームワークのこれまでとこれから
ssssota
1
880
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
9
980
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
320
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
770
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
How to Ace a Technical Interview
jacobian
281
24k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
Joys of Absence: A Defence of Solitary Play
codingconduct
1
490
How to build a perfect <img>
jonoalderson
1
6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
840
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Transcript
DVD of Rails 63rd RubyKansai Takashi Ogomori
Detonation Velocity Development Ruby on Rails Demonstration of Live Coding.
Let's Make the Doorkeeper with Rails. 2/18
Rails New Rails Server rails new doorswatch cd doorswatch/ rails
server 3/18
Welcome Welcome Controller Root Route rails generate controller welcome index
cat << __EOS__ > ./config/routes.rb Rails.application.routes.draw do root 'welcome#index' end __EOS__ 4/18
Bootstrap Gemfile Bundler gem 'therubyracer', platforms: :ruby echo "gem 'twitter-bootswatch-rails'"
>> Gemfile echo "gem 'twitter-bootswatch-rails-helpers'" >> Gemfile bundle 5/18
Bootswatch Theme Layout rails generate bootswatch:install yeti rails generate bootswatch:import
yeti --force rails generate bootswatch:layout yeti cat << __EOS__ > ./app/controllers/welcome_controller.rb class WelcomeController < ApplicationController layout 'yeti' def index end end __EOS__ 6/18
Hello, world! Container cat << __EOS__ > ./app/views/welcome/index.html.erb <div class="container">
<div class="page-header" id="banner"> <div class="row"> <div class="col-lg-8 col-md-7 col-sm-6"> <h1>Welcome</h1> </div> </div> </div> </div> __EOS__ 7/18
Domain Model 8/18
Resources Group User rails generate scaffold group name:string rake db:migrate
rails generate bootswatch:themed Groups --force rails generate scaffold user name:string email:string rake db:migrate rails generate bootswatch:themed Users --force 9/18
Navbar Partial cat << __EOS__ > ./app/views/layouts/_navbar.html.erb <ul class="nav navbar-nav">
<%= content_tag(:li, class: controller_name == 'groups' ? :active : nil) do %> <% link_to :Groups, groups_path %> <% end %> <%= content_tag(:li, class: controller_name == 'users' ? :active : nil) do %> <% link_to :Users, users_path %> <% end %> </ul> __EOS__ 10/18
References Member Groups Route rails generate scaffold member group:references user:references
rake db:migrate rails generate bootswatch:themed Members --force resources :groups do resources :members end 11/18
Link Groups Show Members Index <%= link_to t('.members', :default =>
t("helpers.links.members")), group_members_path(@group), :class => 'btn' %> <%= link_to t('.new', :default => t("helpers.links.new")), new_group_member_path, :class => 'btn btn-primary' %> 12/18
Model Group User class Group < ActiveRecord::Base has_many :members has_many
:users, through: :members end class User < ActiveRecord::Base has_many :members has_many :groups, through: :members end 13/18
Controller Before Action Create Private before_action :set_group, only: [:new, :create]
@member = @group.members.new(member_params) def set_group @group = Group.find(params[:group_id]) end 14/18
View Form Show <%= form_for [@group, @member], :html => {
:class => 'form-horizontal' } do |f| %> <div class="form-group"> <%= f.label :user_id, :class => 'control-label' %> <%= f.collection_select :user_id, User.all, :id, :name, {prompt: "Select for a user"}, :class => 'form-control' %> </div> <dl class="dl-horizontal"> <dt><strong><%= model_class.human_attribute_name(:group_id) %>:</strong></dt> <dd><%= @member.group.name %></dd> <dt><strong><%= model_class.human_attribute_name(:user_id) %>:</strong></dt> <dd><%= @member.user.name %></dd> </dl> 15/18
Octicons Bundler Plus echo "gem 'octicons-rails'" >> Gemfile bundle <%=
link_to new_group_member_path, :class => 'btn btn-primary' do %> <span class="octicon octicon-plus"></span> <span><%= t('.new', :default => t("helpers.links.new")) %></span> <% end %> 16/18
Gravatar Bundler Image Tag echo "gem 'gravatar_image_tag'" >> Gemfile bundle
<td> <%= gravatar_image_tag(member.user.email, alt: member.user.name, gravatar: { size: 28 }) %> <%= member.user.name %> </td> 17/18
Thank You! ♥ ɿ? 18/18