1
2
3
4
5
6
7
app/                                                controllers                                (2)                config/  ...
9
10
11
class You  def self.hello     You.hello # hello   puts “hello”      you = You.new  end                you.hello # error   ...
a = 120a = 100             if a == 100if a == 100           puts "100!"  puts "100!"       elsif a == 120else             ...
list = [1,2,3]           list = [1,2,3]list.each do |it|        list.each { |it|  puts it                  puts itend     ...
"a".twice # error   class You                      privateclass String          def secret  def twice            puts “sle...
16
17
class BlogsController  def index # <= end def edit endend                        18
class Blog < ActiveRecord::Baseend                     19
app/views/blogs/{action}.html.erbapp/views/layouts/blogs.html.erborapp/views/layouts/application.html.erb                 ...
<%= 100 %><% if a == 100 %><div>Hello!</div><% end %><%# comment %>                    21
<%= render form %>_form.html.erb                 22
class BlogsController  def index # <=         <% @list.each do |it| %>                         <div><%= it %></div>  @list...
24
>> entry = Blog.first>> entry.title>> entry.title = “heeeelp”>> entry.save                       25
class Blog < ActiveRecord::Baseend                        class CreateBlogs < ActiveRecord::Migration                     ...
Upcoming SlideShare
Loading in …5
×

Rails3ハンズオン資料

1,130 views

Published on

2011/6/8に下北沢オープンソースカフェで行われたRails3ハンズオンの資料です。

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,130
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Rails3ハンズオン資料

    1. 1. 1
    2. 2. 2
    3. 3. 3
    4. 4. 4
    5. 5. 5
    6. 6. 6
    7. 7. 7
    8. 8. app/ controllers (2) config/ routes.rb (1) (3) (5) (4)User (6) app/models app/views 8
    9. 9. 9
    10. 10. 10
    11. 11. 11
    12. 12. class You def self.hello You.hello # hello puts “hello” you = You.new end you.hello # error you.morning # morning def morning puts “morning” endend 12
    13. 13. a = 120a = 100 if a == 100if a == 100 puts "100!" puts "100!" elsif a == 120else puts "120!" puts "not 100!" elseend puts “?” end 13
    14. 14. list = [1,2,3] list = [1,2,3]list.each do |it| list.each { |it| puts it puts itend } 14
    15. 15. "a".twice # error class You privateclass String def secret def twice puts “sleeping” self + self end end endend you = You.new you.secret # error"a".twice # => "aa you.send(:secret) # => sleeping 15
    16. 16. 16
    17. 17. 17
    18. 18. class BlogsController def index # <= end def edit endend 18
    19. 19. class Blog < ActiveRecord::Baseend 19
    20. 20. app/views/blogs/{action}.html.erbapp/views/layouts/blogs.html.erborapp/views/layouts/application.html.erb 20
    21. 21. <%= 100 %><% if a == 100 %><div>Hello!</div><% end %><%# comment %> 21
    22. 22. <%= render form %>_form.html.erb 22
    23. 23. class BlogsController def index # <= <% @list.each do |it| %> <div><%= it %></div> @list = [1,2,3] <% end %> @list.pop end def edit endend 23
    24. 24. 24
    25. 25. >> entry = Blog.first>> entry.title>> entry.title = “heeeelp”>> entry.save 25
    26. 26. class Blog < ActiveRecord::Baseend class CreateBlogs < ActiveRecord::Migration def self.up>> entry = Blog.first create_table :blogs do |t|>> entry.title t.string :title t.text :body t.timestamps end end end 26

    ×