Rails解説セミナー 第4章

41
4 Rails Ruby #Rails http://railstutorial.jp/ Rails by YassLab

Transcript of Rails解説セミナー 第4章

4 Rails Ruby #Rails

http://railstutorial.jp/

Rails

by YassLab

Slideshare

http://www.slideshare.net/yasulab/presentations

Cloud9

1. 2. URL 3.

https://ide.c9.io/yasulab/rails-tutorial

https://rails-tutorial-yasulab.c9users.io/

URL “Collaborate” → “Group Chat”

! :)

Ready?

!

4 Rails Ruby #Rails

http://railstutorial.jp/

Rails

by YassLab

• .

• scaffold :

• .

• .

• rails generate About .

• DRY

Model-View-Controller (MVC)

Router

Controller

View

Model

DatabaseReq.

HTML

3

4

• :

• Home

• Ruby :

1.

2. ( /Block/Hash/ )

3. ( / / )

4. Rails (Controller / User)

4 Rails Ruby 4.1

http://railstutorial.jp/

Rails

by YassLab

•4.1.

• :title ‘|’

4.1.

• :title ‘|’

4.1.

• Helper

• Helper

• : ApplicationHelper, StaticPagesHelper

• Helper

• (RED)

• Static Pages Home

• (GREEN)

4.1.

4.1.

“full_title

Ruby ”

4.1.

Ruby !

Y^Y^Y^Y^Y^Y^Y^Y^Y^Y

4 Rails Ruby 4.2 (string)

http://railstutorial.jp/

Rails

by YassLab

:

$ touch ~/.irbrc$ c9 open ~/.irbrc

: gem

$ gem install pry$ pry>> puts “Hi”

• : # ( )

• : “#{object}”

• : puts, print

• (‘) vs. (“)

• :

4.2. (string)

4 Rails Ruby 4.3

http://railstutorial.jp/

Rails

by YassLab

• [“foo”, “bar”, “baz”] (0..9).to_a # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

• (1..5).each { |i| puts 2 * i } => 2 4 6 8 10

• h1 = { :name => “Yohei”, :email => “[email protected]” } h2 = { name: “Yohei”, email: “[email protected]” }

4.3.

4 Rails Ruby 4.4 Ruby

http://railstutorial.jp/

Rails

by YassLab

• : String, Fixnum, Hash, Array, …

• Rails

• User

4.4. Ruby

Ruby / Rails

StaticPagesControllerWord

• :

• Home

• Ruby :

1.

2. ( /Block/Hash/ )

3. ( / / )

4. Rails (Controller / User)

Model-View-Controller (MVC)

Router

Controller

View

Model

DatabaseReq.

HTML

3

4

Ruby http://magazine.rubyist.net/?FirstStepRuby

:

Ruby -

Ruby https://github.com/ruby-no-kai/official/wiki/RegionalRubyistMeetUp

Ruby https://docs.ruby-lang.org/ja/

:

https://docs.ruby-lang.org/ja/search/

• :)

• : http://railstutorial.jp/seminars

• :) ,

.

• , .

4 Rails Ruby #Rails

http://railstutorial.jp/

Rails

by YassLab