Commit Graph

10 Commits

Author SHA1 Message Date
taitus
99495a21d2 Add load_and_authorize_resource to videos controller 2022-09-14 14:45:36 +02:00
taitus
b17b03099c Load videos through answer in all actions 2022-09-14 14:45:36 +02:00
taitus
919534fbc5 Unify with the rest of application destroy method in videos controller 2022-09-14 14:45:36 +02:00
taitus
1ec793863b Add missing system specs for poll question answer videos
Minor change for replace @video.answer_id to @video.answer.
2022-09-14 14:45:35 +02:00
Javi Martín
11832cc07d Make it easier to customize allowed parameters
When customizing CONSUL, one of the most common actions is adding a new
field to a form.

This requires modifying the permitted/allowed parameters. However, in
most cases, the method returning these parameters returned an instance
of `ActionController::Parameters`, so adding more parameters to it
wasn't easy.

So customizing the code required copying the method returning those
parameters and adding the new ones. For example:

```
def something_params
  params.require(:something).permit(
    :one_consul_attribute,
    :another_consul_attribute,
    :my_custom_attribute
  )
end
```

This meant that, if the `something_params` method changed in CONSUL, the
customization of this method had to be updated as well.

So we're extracting the logic returning the parameters to a method which
returns an array. Now this code can be customized without copying the
original method:

```
alias_method :consul_allowed_params, :allowed_params

def allowed_params
  consul_allowed_params + [:my_custom_attribute]
end
```
2022-04-07 19:35:40 +02:00
Javi Martín
daa86ca3fc Apply Rails/RequestReferer rubocop rule 2019-09-10 21:43:39 +02:00
Javi Martín
e252d82cdb Apply IndentationWidth rubocop rule 2019-09-10 20:02:15 +02:00
Julian Herrero
fb81f45a73 Fix redirect_to :back deprecation warning 2019-04-17 17:40:55 +02:00
Bertocq
ce0a7f6fad Rubocop autocorrections 2017-10-17 22:00:00 +02:00
Angel Perez
5862eea516 Add controllers/views for Poll::Question::Answer::Video 2017-10-05 12:34:20 -04:00