Skip to content

Commit

Permalink
Refs #16: add rails-jquery to make deletion work
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBrendel committed Nov 3, 2017
1 parent 50a5992 commit c7cf4de
Show file tree
Hide file tree
Showing 9 changed files with 591 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .idea/.rakeTasks

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .idea/exercise.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

610 changes: 565 additions & 45 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source 'https://rubygems.org'

gem 'jquery-rails'
gem 'turbolinks'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
Expand Down
11 changes: 10 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ GEM
globalid (0.3.6)
activesupport (>= 4.1.0)
i18n (0.7.0)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
Expand Down Expand Up @@ -123,6 +127,9 @@ GEM
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.5)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.3)
tzinfo (1.2.2)
thread_safe (~> 0.1)
web-console (2.2.1)
Expand All @@ -140,11 +147,13 @@ DEPENDENCIES
byebug
capybara (~> 2.5)
factory_girl_rails (~> 4.5)
jquery-rails
rails (= 4.2.4)
rspec-rails (~> 3.3)
spring
sqlite3
turbolinks
web-console (~> 2.0)

BUNDLED WITH
1.11.2
1.16.0
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require_tree .
7 changes: 7 additions & 0 deletions app/controllers/authors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ def update
render 'edit'
end
end

def destroy
@author = Author.find(params[:id])
@author.destroy

redirect_to authors_path
end
end

private
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<title>Paper Management System</title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions spec/features/author/index_author_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
visit authors_path

expect(page).to have_link('Destroy')
expect(Author.find_by_first_name('Alan')).not_to be_nil
click_link('Destroy')
expect(Author.find_by_first_name('Alan')).to be_nil
end
Expand Down

0 comments on commit c7cf4de

Please sign in to comment.