Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. diff --git a/app/controllers/macros_controller.rb b/app/controllers/macros_controller.rb
  2. index 1faa1ee..37c381c 100644
  3. --- a/app/controllers/macros_controller.rb
  4. +++ b/app/controllers/macros_controller.rb
  5. @@ -16,7 +16,7 @@ class MacrosController < ApplicationController
  6. end
  7.  
  8. def create
  9. - @macro = WikiMacro.new(params[:wiki_macro])
  10. + @macro = WikiMacro.new(macro_params)
  11. if request.post? && @macro.save
  12. flash[:notice] = l(:notice_successful_create)
  13. @macro.register!
  14. @@ -26,12 +26,16 @@ class MacrosController < ApplicationController
  15. end
  16. end
  17.  
  18. + def macro_params
  19. + params.require(:wiki_macro).permit(:name, :description, :content)
  20. + end
  21. +
  22. def edit; end
  23.  
  24. def update
  25. if request.patch?
  26. old_name = @macro.name
  27. - @macro.attributes = params[:wiki_macro]
  28. + @macro.attributes = macro_params
  29. name_changed = @macro.name_changed?
  30. desc_changed = @macro.description_changed?
  31. if @macro.save
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement