Hello
Robert Dempsey
adsdevshop.com
adsdevshop.com/apps
rdempsey
A-Z Intro To
Ruby on Rails
Always
Be
Learning
Teach Others
Be Bold
Whatʼs Going On
• Introduction to Ruby
• Introduction to Rails
• Hands-on Lab
• Breaks interspersed
Ruby
1995
2006
Perl
  SmallTalk
  Eiffel
  Ada
+ Lisp
  Ruby
#10 baby!
5.times { print “We love Ruby” }
class Numeric
 def plus(x)
   self.+(x)
 end
end

y = 5.plus 6
# y is now equal to 11
Rails
2005
Image copyright 2008 Yoshiko314 (Flickr)
MVC
Model
View
Controller
Model
View
Controller
Model
View
Controller
Model
View
Controller
map.root :controller => ʻemployersʼ
Action    HTTP Method URL           XML
index     GET        /jobs          /jobs.xml

show      GET        /jobs/1       ...
Letʼs Build
Something
The Project
• Employers
• Jobs
rails jobby -d postgresql
rails jobby -d mysql
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
app/
 controllers/
 helpers/
 models/
 views/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
README
Rakefile
app/
config/
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
development:
   adapter: postgresql
   encoding: unicode
   database: jobby_development
   pool: 5
   username: root
   pa...
development:
   adapter: mysql
   encoding: utf8
   database: jobby_development
   pool: 5
   username: root
   password:
...
rake db:create
script/server
rm public/index.html
map.connect ʻ:controller/:action/:idʼ

map.connect ʻ:controller/:action/:id.:formatʼ




config/routes.rb
script/generate model Employer
script/generate scaffold Employer
   name:string
   address:string
   city:string
   state:string
   zipcode:string
exists app/models/
  exists app/controllers/
  exists app/helpers/
  create app/views/employers
  exists app/views/layouts...
app/models/employer.rb
db/migrate/20090...1_create_employers.rb
app/views/employers/index.html.erb
app/views/employers/sho...
class CreateEmployers < ActiveRecord::Migration
 def self.up
   create_table :employers do |t|
    t.string :name
    t.st...
rake db:migrate
map.root :controller => ʻemployersʼ




config/routes.rb
http://localhost:3000/
class Employer < ActiveRecord::Base
end




app/models/employer.rb
class Employer < ActiveRecord::Base
   validates_presence_of :name
   validates_length_of :city, :minimum => 3
end




app...
http://localhost:3000/employers/new
Controller => CRUD
Model => Logic
script/console
# GET /employers
# GET /employers.xml
def index
 @employers = Employer.all

 respond_to do |format|
  format.html # index....
# GET /employers
# GET /employers.xml
def index
 @employers = Employer.all

 respond_to do |format|
  format.html # index....
# GET /employers
# GET /employers.xml
def index
 @employers = Employer.all

   respond_to do |format|
     format.html # i...
app/views/employers/index.html.erb
<%=h employer.name %>




app/views/employers/index.html.erb
<%= link_to 'New employer', ... %>




app/views/employers/index.html.erb
edit_employer_path(employer)




app/views/employers/index.html.erb
app/views/layouts/employers.html.erb
# GET /employers/new
# GET /employers/new.xml
def new
 @employer = Employer.new

 respond_to do |format|
  format.html # n...
app/views/employers/new.html.erb
# POST /employers
# POST /employers.xml
def create
 @employer = Employer.new(params[:employer])

 respond_to do |format|
 ...
# GET /employers/1
# GET /employers/1.xml
def show
 @employer = Employer.find(params[:id])

 respond_to do |format|
  forma...
app/views/employers/show.html.erb
# GET /employers/1/edit
def edit
 @employer = Employer.find(params[:id])
end




app/controllers/employers_controller.rb
app/views/employers/edit.html.erb
# PUT /employers/1
# PUT /employers/1.xml
def update
 @employer = Employer.find(params[:id])

 respond_to do |format|
  if ...
# DELETE /employers/1
# DELETE /employers/1.xml
def destroy
 @employer = Employer.find(params[:id])
 @employer.destroy

 re...
Donʼt
Repeat
Yourself
Partials
_form.html.erb



app/views/employers/_form.html.erb
app/views/employers/_form.html.erb
<%= render :partial => 'form' %>
app/views/employers/new.html.erb
app/views/employers/edit.html.erb
<%= render :partial => 'shared/form' %>
@employer = Employer.find(params[:id])




app/controllers/employers_controller.erb
before_filter :find_employer,
   :only => [:show, :edit, :update, :destroy]




app/controllers/employers_controller.rb
app/controllers/employers_controller.rb
private
   def find_employer
    @employer = Employer.find(params[:id])
   end




app/controllers/employers_controller.rb
app/controllers/employers_controller.rb
script/generate scaffold Job
name:string
description:text
class CreateJobs < ActiveRecord::Migration
 def self.up
   create_table :jobs do |t|
    t.integer :employer_id
    t.stri...
rake db:migrate
belongs_to
has_one
has_many
has_many :through
has_one :through
has_and_belongs_to_many
jobs                employers
Model: Job             Model: Employer
belongs_to :employer   has_many :jobs
id          int...
employers                   jobs
Model: Employer          Model: Job
has_one :job             belongs_to :employer
id     ...
employers                  jobs
Model: Employer         Model: Job
has_many :jobs          belongs_to :employer
id        ...
physicians
Model: Physician
has_many :appointments
has_many :patients,
:through => :appointments
                         ...
physicians
Model: Physician
has_and_belongs_to_many :patients



id               integer               physicians_patient...
class Job < ActiveRecord::Base
end




app/models/job.rb
class Job < ActiveRecord::Base
      belongs_to :employer

  validates_presence_of :name
  validates_presence_of :descript...
class Job < ActiveRecord::Base
   belongs_to :employer

     validates_presence_of :name
     validates_presence_of :descr...
class Employer < ActiveRecord::Base
     has_many :jobs

  validates_presence_of :name
  validates_length_of :city, :minim...
map.resources :employers


map.resources :employers,
  :has_many => :jobs

map.resources :jobs



app/controllers/employer...
before_filter :find_employer




app/controllers/jobs_controller.rb
app/controllers/jobs_controller.rb
private
   def find_employer
    @employer = Employer.find(params[:employer_id])
   end




app/controllers/jobs_controller....
app/controllers/jobs_controller.rb
# GET /jobs
# GET /jobs.xml
def index
 @jobs = @employer.jobs

 respond_to do |format|
  format.html # index.html.erb
  fo...
# GET /jobs/new
# GET /jobs/new.xml
def new
 @job = Job.new
 @job = @employer.jobs.build

 respond_to do |format|
  format...
@job = @employer.jobs.build
app/views/jobs/index.html.erb
# POST /jobs
# POST /jobs.xml
def create
 @employer = Employer.find(params[:employer_id])
 @job = @employer.jobs.build(para...
# GET /jobs/1
# GET /jobs/1.xml
def show
 @job = @employer.jobs.find(params[:id])

 respond_to do |format|
  format.html # ...
app/views/jobs/show.html.erb
# GET /jobs/1/edit
def edit
 @job = @employer.jobs.find(params[:id])
end




app/controllers/jobs_controller.rb
app/views/jobs/edit.html.erb
# PUT /jobs/1
# PUT /jobs/1.xml
def update
 @job = Job.find(params[:id])

 respond_to do |format|
  if @job.update_attribut...
# DELETE /jobs/1
# DELETE /jobs/1.xml
def destroy
 @job = Job.find(params[:id])
 @job.destroy

 respond_to do |format|
  fo...
app/views/employers/show.html.erb
app/views/jobs/index.html.erb
app/views/jobs/index.html.erb
app/views/employers/index.html.erb
app/views/employers/index.html.erb
app/controllers/employers_controller.rb
app/controllers/employers_controller.rb
app/views/employers/index.html.erb
app/views/employers/index.html.erb
app/controllers/jobs_controller.rb
app/controllers/employers_controller.rb
app/views/employers/index.html.erb
Next Steps
DRY up our Job views

Add search to our jobs

Add a logins for employers

Add tags to our jobs
Resources
Rails Guides

Agile Web Development (PP)

Intro to Ruby 1.9

Cucumber + RSpec
Contest!
Letʼs Chat
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
A Z Introduction To Ruby On Rails
Upcoming SlideShare
Loading in...5
×

A Z Introduction To Ruby On Rails

1,571

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,571
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
67
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

A Z Introduction To Ruby On Rails

  1. 1. Hello
  2. 2. Robert Dempsey
  3. 3. adsdevshop.com
  4. 4. adsdevshop.com/apps
  5. 5. rdempsey
  6. 6. A-Z Intro To Ruby on Rails
  7. 7. Always Be Learning
  8. 8. Teach Others
  9. 9. Be Bold
  10. 10. Whatʼs Going On • Introduction to Ruby • Introduction to Rails • Hands-on Lab • Breaks interspersed
  11. 11. Ruby
  12. 12. 1995
  13. 13. 2006
  14. 14. Perl SmallTalk Eiffel Ada + Lisp Ruby
  15. 15. #10 baby!
  16. 16. 5.times { print “We love Ruby” }
  17. 17. class Numeric def plus(x) self.+(x) end end y = 5.plus 6 # y is now equal to 11
  18. 18. Rails
  19. 19. 2005
  20. 20. Image copyright 2008 Yoshiko314 (Flickr)
  21. 21. MVC
  22. 22. Model View Controller
  23. 23. Model View Controller
  24. 24. Model View Controller
  25. 25. Model View Controller
  26. 26. map.root :controller => ʻemployersʼ
  27. 27. Action HTTP Method URL XML index GET /jobs /jobs.xml show GET /jobs/1 /jobs/1.xml new GET /jobs/new edit GET /jobs/1;edit create POST /jobs /jobs.xml update PUT /jobs/1 /jobs/1.xml destroy DELETE /jobs/1 /jobs/1.xml
  28. 28. Letʼs Build Something
  29. 29. The Project • Employers • Jobs
  30. 30. rails jobby -d postgresql
  31. 31. rails jobby -d mysql
  32. 32. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  33. 33. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  34. 34. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  35. 35. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  36. 36. app/ controllers/ helpers/ models/ views/
  37. 37. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  38. 38. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  39. 39. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  40. 40. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  41. 41. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  42. 42. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  43. 43. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  44. 44. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  45. 45. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  46. 46. README Rakefile app/ config/ db/ doc/ lib/ log/ public/ script/ test/ tmp/ vendor/
  47. 47. development: adapter: postgresql encoding: unicode database: jobby_development pool: 5 username: root password: config/database.yml
  48. 48. development: adapter: mysql encoding: utf8 database: jobby_development pool: 5 username: root password: socket: /tmp/mysql.sock config/database.yml
  49. 49. rake db:create
  50. 50. script/server
  51. 51. rm public/index.html
  52. 52. map.connect ʻ:controller/:action/:idʼ map.connect ʻ:controller/:action/:id.:formatʼ config/routes.rb
  53. 53. script/generate model Employer
  54. 54. script/generate scaffold Employer name:string address:string city:string state:string zipcode:string
  55. 55. exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/employers exists app/views/layouts/ exists test/functional/ exists test/unit/ create test/unit/helpers/ exists public/stylesheets/ create app/views/employers/index.html.erb create app/views/employers/show.html.erb create app/views/employers/new.html.erb create app/views/employers/edit.html.erb create app/views/layouts/employers.html.erb create public/stylesheets/scaffold.css create app/controllers/employers_controller.rb create test/functional/employers_controller_test.rb create app/helpers/employers_helper.rb create test/unit/helpers/employers_helper_test.rb route map.resources :employers dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/employer.rb create test/unit/employer_test.rb create test/fixtures/employers.yml create db/migrate create db/migrate/20090501175821_create_employers.rb
  56. 56. app/models/employer.rb db/migrate/20090...1_create_employers.rb app/views/employers/index.html.erb app/views/employers/show.html.erb app/views/employers/new.html.erb app/views/employers/edit.html.erb app/views/layouts/employers.html.erb public/stylesheets/scaffold.css app/controllers/employers_controller.rb app/helpers/employers_helper.rb test/functional/employers_controller_test.rb test/unit/helpers/employers_helper_test.rb test/unit/employer_test.rb test/fixtures/employers.yml route map.resources :employers
  57. 57. class CreateEmployers < ActiveRecord::Migration def self.up create_table :employers do |t| t.string :name t.string :address t.string :city t.string :state t.string :zipcode t.timestamps end end def self.down drop_table :employers end end db/migrations/2009...create_employers.rb
  58. 58. rake db:migrate
  59. 59. map.root :controller => ʻemployersʼ config/routes.rb
  60. 60. http://localhost:3000/
  61. 61. class Employer < ActiveRecord::Base end app/models/employer.rb
  62. 62. class Employer < ActiveRecord::Base validates_presence_of :name validates_length_of :city, :minimum => 3 end app/models/employer.rb
  63. 63. http://localhost:3000/employers/new
  64. 64. Controller => CRUD
  65. 65. Model => Logic
  66. 66. script/console
  67. 67. # GET /employers # GET /employers.xml def index @employers = Employer.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @employers } end end app/controllers/employers_controller.rb
  68. 68. # GET /employers # GET /employers.xml def index @employers = Employer.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @employers } end end app/controllers/employers_controller.rb
  69. 69. # GET /employers # GET /employers.xml def index @employers = Employer.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @employers } end end app/controllers/employers_controller.rb
  70. 70. app/views/employers/index.html.erb
  71. 71. <%=h employer.name %> app/views/employers/index.html.erb
  72. 72. <%= link_to 'New employer', ... %> app/views/employers/index.html.erb
  73. 73. edit_employer_path(employer) app/views/employers/index.html.erb
  74. 74. app/views/layouts/employers.html.erb
  75. 75. # GET /employers/new # GET /employers/new.xml def new @employer = Employer.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @employer } end end app/controllers/employers_controller.rb
  76. 76. app/views/employers/new.html.erb
  77. 77. # POST /employers # POST /employers.xml def create @employer = Employer.new(params[:employer]) respond_to do |format| if @employer.save flash[:notice] = 'Employer was successfully created.' format.html { redirect_to(@employer) } format.xml { render :xml => @employer, :status => :created, :location => @employer } else format.html { render :action => quot;newquot; } format.xml { render :xml => @employer.errors, :status => :unprocessable_entity } end end end app/controllers/employers_controller.rb
  78. 78. # GET /employers/1 # GET /employers/1.xml def show @employer = Employer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @employer } end end app/controllers/employers_controller.rb
  79. 79. app/views/employers/show.html.erb
  80. 80. # GET /employers/1/edit def edit @employer = Employer.find(params[:id]) end app/controllers/employers_controller.rb
  81. 81. app/views/employers/edit.html.erb
  82. 82. # PUT /employers/1 # PUT /employers/1.xml def update @employer = Employer.find(params[:id]) respond_to do |format| if @employer.update_attributes(params[:employer]) flash[:notice] = 'Employer was successfully updated.' format.html { redirect_to(@employer) } format.xml { head :ok } else format.html { render :action => quot;editquot; } format.xml { render :xml => @employer.errors, :status => :unprocessable_entity } end end end app/controllers/employers_controller.rb
  83. 83. # DELETE /employers/1 # DELETE /employers/1.xml def destroy @employer = Employer.find(params[:id]) @employer.destroy respond_to do |format| format.html { redirect_to(employers_url) } format.xml { head :ok } end end app/controllers/employers_controller.rb
  84. 84. Donʼt Repeat Yourself
  85. 85. Partials
  86. 86. _form.html.erb app/views/employers/_form.html.erb
  87. 87. app/views/employers/_form.html.erb
  88. 88. <%= render :partial => 'form' %>
  89. 89. app/views/employers/new.html.erb
  90. 90. app/views/employers/edit.html.erb
  91. 91. <%= render :partial => 'shared/form' %>
  92. 92. @employer = Employer.find(params[:id]) app/controllers/employers_controller.erb
  93. 93. before_filter :find_employer, :only => [:show, :edit, :update, :destroy] app/controllers/employers_controller.rb
  94. 94. app/controllers/employers_controller.rb
  95. 95. private def find_employer @employer = Employer.find(params[:id]) end app/controllers/employers_controller.rb
  96. 96. app/controllers/employers_controller.rb
  97. 97. script/generate scaffold Job name:string description:text
  98. 98. class CreateJobs < ActiveRecord::Migration def self.up create_table :jobs do |t| t.integer :employer_id t.string :name t.text :description t.timestamps end end def self.down drop_table :jobs end end db/migrations/2009...create_jobs.rb
  99. 99. rake db:migrate
  100. 100. belongs_to has_one has_many has_many :through has_one :through has_and_belongs_to_many
  101. 101. jobs employers Model: Job Model: Employer belongs_to :employer has_many :jobs id integer id integer employer_id integer name string name string address string
  102. 102. employers jobs Model: Employer Model: Job has_one :job belongs_to :employer id integer id integer name string employer_id integer address string name string
  103. 103. employers jobs Model: Employer Model: Job has_many :jobs belongs_to :employer id integer id integer name string employer_id integer address string name string
  104. 104. physicians Model: Physician has_many :appointments has_many :patients, :through => :appointments appointments id integer Model: Appointment name string belongs_to :physician belongs_to :patient id integer patients physician_id integer Model: Patient patient_id integer has_many :appointments has_many :physicians, :through => :appointments id integer name string
  105. 105. physicians Model: Physician has_and_belongs_to_many :patients id integer physicians_patients name string physician_id integer patients patient_id integer Model: Patient has_and_belongs_to_many :physicians id integer name string
  106. 106. class Job < ActiveRecord::Base end app/models/job.rb
  107. 107. class Job < ActiveRecord::Base belongs_to :employer validates_presence_of :name validates_presence_of :description end app/models/job.rb
  108. 108. class Job < ActiveRecord::Base belongs_to :employer validates_presence_of :name validates_presence_of :description end app/models/job.rb
  109. 109. class Employer < ActiveRecord::Base has_many :jobs validates_presence_of :name validates_length_of :city, :minimum => 3 end app/models/employer.rb
  110. 110. map.resources :employers map.resources :employers, :has_many => :jobs map.resources :jobs app/controllers/employers_controller.rb
  111. 111. before_filter :find_employer app/controllers/jobs_controller.rb
  112. 112. app/controllers/jobs_controller.rb
  113. 113. private def find_employer @employer = Employer.find(params[:employer_id]) end app/controllers/jobs_controller.rb
  114. 114. app/controllers/jobs_controller.rb
  115. 115. # GET /jobs # GET /jobs.xml def index @jobs = @employer.jobs respond_to do |format| format.html # index.html.erb format.xml { render :xml => @jobs } end end app/controllers/jobs_controller.rb
  116. 116. # GET /jobs/new # GET /jobs/new.xml def new @job = Job.new @job = @employer.jobs.build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @job } end end app/controllers/jobs_controller.rb
  117. 117. @job = @employer.jobs.build
  118. 118. app/views/jobs/index.html.erb
  119. 119. # POST /jobs # POST /jobs.xml def create @employer = Employer.find(params[:employer_id]) @job = @employer.jobs.build(params[:job]) respond_to do |format| if @job.save flash[:notice] = 'Job was successfully created.' format.html { redirect_to employer_job_url(@employer, @job) } format.xml { render :xml => @job, :status => :created, :location => @job } else format.html { render :action => quot;newquot; } format.xml { render :xml => @job.errors, :status => :unprocessable_entity } end end end app/controllers/jobs_controller.rb
  120. 120. # GET /jobs/1 # GET /jobs/1.xml def show @job = @employer.jobs.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @job } end end app/controllers/jobs_controller.rb
  121. 121. app/views/jobs/show.html.erb
  122. 122. # GET /jobs/1/edit def edit @job = @employer.jobs.find(params[:id]) end app/controllers/jobs_controller.rb
  123. 123. app/views/jobs/edit.html.erb
  124. 124. # PUT /jobs/1 # PUT /jobs/1.xml def update @job = Job.find(params[:id]) respond_to do |format| if @job.update_attributes(params[:job]) flash[:notice] = 'Job was successfully updated.' format.html { redirect_to employer_job_url(@employer, @job) } format.xml { head :ok } else format.html { render :action => quot;editquot; } format.xml { render :xml => @job.errors, :status => :unprocessable_entity } end end end app/controllers/jobs_controller.rb
  125. 125. # DELETE /jobs/1 # DELETE /jobs/1.xml def destroy @job = Job.find(params[:id]) @job.destroy respond_to do |format| format.html { redirect_to employer_jobs_url(@employer) } format.xml { head :ok } end end app/controllers/jobs_controller.rb
  126. 126. app/views/employers/show.html.erb
  127. 127. app/views/jobs/index.html.erb
  128. 128. app/views/jobs/index.html.erb
  129. 129. app/views/employers/index.html.erb
  130. 130. app/views/employers/index.html.erb
  131. 131. app/controllers/employers_controller.rb
  132. 132. app/controllers/employers_controller.rb
  133. 133. app/views/employers/index.html.erb
  134. 134. app/views/employers/index.html.erb
  135. 135. app/controllers/jobs_controller.rb
  136. 136. app/controllers/employers_controller.rb
  137. 137. app/views/employers/index.html.erb
  138. 138. Next Steps
  139. 139. DRY up our Job views Add search to our jobs Add a logins for employers Add tags to our jobs
  140. 140. Resources
  141. 141. Rails Guides Agile Web Development (PP) Intro to Ruby 1.9 Cucumber + RSpec
  142. 142. Contest!
  143. 143. Letʼs Chat
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×