Skip to content

Commit

Permalink
Update decent exposure to 3.0 (#468)
Browse files Browse the repository at this point in the history
* Update decent exposure to 3.0
* Remove unused flash messages in controller scaffold
  • Loading branch information
Alexey Kuznetsov authored and timurvafin committed Sep 13, 2016
1 parent 3b2a596 commit 45ecb01
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Upgrade [decent exposure](https://github.com/hashrocket/decent_exposure) to 3.0
- Email previews for `DeviseMailer` at http://lvh.me:5000/rails/mailers
- Upgrade [rails](https://github.com/rails/rails) to 4.2.7.1
- Update foundation to 6 version
Expand Down
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ GEM
database_cleaner (1.3.0)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
decent_decoration (0.0.6)
decent_exposure (>= 2.0)
decent_exposure (2.3.1)
decent_decoration (0.1.0)
decent_exposure (~> 3.0)
decent_exposure (3.0.0)
activesupport (>= 4.0)
devise (3.5.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ class ApplicationController < ActionController::Base

responders :flash
respond_to :html

decent_configuration do
strategy DecentExposure::StrongParametersStrategy
end
end
8 changes: 4 additions & 4 deletions lib/templates/rails/scaffold_controller/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
class <%= controller_class_name %>Controller < ApplicationController
respond_to :html

expose(:<%= singular_table_name %>, attributes: :<%= singular_table_name %>_params)
expose(:<%= plural_table_name %>) { <%= class_name %>.page(params[:page]) }
expose :<%= singular_table_name %>
expose :<%= plural_table_name %>, -> { <%= class_name %>.page(params[:page]) }
def create
flash[:notice] = '<%= human_name %> was successfully created.' if <%= singular_table_name %>.save
<%= singular_table_name %>.save
respond_with(<%= singular_table_name %>)
end
def update
flash[:notice] = '<%= human_name %> was successfully updated.' if <%= singular_table_name %>.save
<%= singular_table_name %>.update_attributes(<%= singular_table_name %>_params)
respond_with(<%= singular_table_name %>)
end

Expand Down

0 comments on commit 45ecb01

Please sign in to comment.