aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorTeddy Wing2017-07-07 16:42:58 +0200
committerTeddy Wing2017-07-12 11:06:03 +0200
commit9ab672a31cd3a1aeea59e6ae3dab96e4057ee997 (patch)
tree73632f15c1c107b88fb27b848eab1fa6cc0f8ac8 /script
parentd4be863478181b126faaafe25cfb293dca058570 (diff)
downloadchouette-core-9ab672a31cd3a1aeea59e6ae3dab96e4057ee997.tar.bz2
CustomLinks: Pass referential directly when initialising
Instead of getting the referential to use when building the polymorphic URL from the `UserContext`, pass in a referential directly. The old code that used `user_context.context[:referential]` relied on the fact that `ApplicationController#pundit_user` was defined as follows: def pundit_user UserContext.new(current_user, referential: self.try(:current_referential)) end (We pass `pundit_user` into `CustomLinks` from `TableBuilderHelper#build_links`.) However, Robert's change 747d333ffbcc8ee0c9f1daf93ccca32799434e04 removes the `current_referential` call from `#pundit_user`. In `CustomLinks`, we actually always want to be using `current_referential`. For example, on `Companies#index` (/line_referentials/:id/companies), `CustomLinks` fails to build a correct #show link because `user_context.context[:referential]` is `nil`, when it should instead be a `LineReferential` object, that gets returned by the `#current_referential` helper method. Sure, `#current_referential` is hard to understand, so maybe we'll change that around in the future, but this at least allows us to use the current referential in `CustomLinks`. Refs #3479
Diffstat (limited to 'script')
0 files changed, 0 insertions, 0 deletions