Created
July 2, 2012 07:37
-
-
Save aarondufall/3031703 to your computer and use it in GitHub Desktop.
Destroy join
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
// This is a manifest file that'll be compiled into application.js, which will include all the files | |
// listed below. | |
// | |
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | |
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. | |
// | |
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | |
// the compiled file. | |
// | |
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD | |
// GO AFTER THE REQUIRES BELOW. | |
// | |
//= require jquery | |
//= require jquery_ujs | |
//= require bootstrap | |
//= require_tree . |
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
<h3> Employees </h3> | |
<br> | |
<ul class="users"> | |
<% @employees.each do |employee| %> | |
<li><%= link_to full_name(employee), employee %></li> | |
<%= link_to "Remove", company_employee_path(employee), :method => :delete %> | |
<% end %> | |
</ul> | |
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
#mostly test code | |
class EmployeesController < ApplicationController | |
def show | |
@company = Company.find(params[:company_id]) | |
@employee = @company.employees.find(params[:id]) | |
end | |
def index | |
@employees = Company.find(params[:company_id]).employees | |
end | |
def destroy | |
redirect_to root_path, notice: "#{params.inspect}" | |
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
<h3> Employees </h3> | |
<br> | |
<ul class="users"> | |
<% @employees.each do |employee| %> | |
<li><%= link_to full_name(employee), employee %></li> | |
<%= link_to "Remove", company_employee_path(@company, employee), :method => :delete %> | |
<% end %> | |
</ul> | |
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
Routing Error | |
No route matches {:action=>"show", :controller=>"employees", :company_id=>nil, :id=>#<Profile id: 1, user_id: 1, first_name: "Aaron", last_name: "Dufall", created_at: "2012-07-02 05:36:13", updated_at: "2012-07-02 05:38:40", deleted: false, company_id: 1>} | |
Try running rake routes for more information on available routes. |
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
resources :companies do | |
resources :employees | |
resources :requests do | |
put 'accept', :on => :member | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment