diff options
| author | Robert | 2017-07-03 08:27:45 +0200 |
|---|---|---|
| committer | Robert | 2017-07-04 21:54:04 +0200 |
| commit | 747d333ffbcc8ee0c9f1daf93ccca32799434e04 (patch) | |
| tree | d475ba66bd6893bac155ddd781f009c74178c10d /app/controllers | |
| parent | ebd292c7a6abaab5aeb90b37e34e21253184979f (diff) | |
| download | chouette-core-747d333ffbcc8ee0c9f1daf93ccca32799434e04.tar.bz2 | |
Refs: #3478@2h Access correct referential in line_footnotes Ctrl
+ ApplicationController provides Pundit's UserContext's referential with `@referential` instead of `current_referential`,
(`@referential` is computed from the URL, while `current_referential` was aliased to different methods, **not always**
pointing to `Referential` instances)
+ ApplicationPolicy uses the record's referential in its `referential method` iff it is an instance of `Referential` else
it uses the abovely provided referential, locally named `@current_referential` (as it should be named in the Ctrl too)
This assures, in combination with the Ctrl Change, that `referential` **always** returns an instance of `Referential`!
- TODO: Review my understanding of _Referential Setup_ inside the Ctrls
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/application_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/line_footnotes_controller.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 42b7c2a25..8fcaa3b1b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base end def pundit_user - UserContext.new(current_user, referential: self.try(:current_referential)) + UserContext.new(current_user, referential: @referential) end protected diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb index c42aa785b..6a9048392 100644 --- a/app/controllers/line_footnotes_controller.rb +++ b/app/controllers/line_footnotes_controller.rb @@ -34,7 +34,7 @@ class LineFootnotesController < BreadcrumbController private def resource @referential = Referential.find params[:referential_id] - @line = @referential.lines.find params[:line_id] + @line = @referential.lines.find params[:line_id] end def line_params |
