The Actions::RequiresApproval module is optional for the following actions
targets-many
targets-one
targets-one-parent
Although it is an optional module, we were trying to show the approved_by attribute in the show views for these actions. We were getting an undefined method approved_by error because the reflection wasn't being declared, and it's only declared when we include the module.
On the other hand, our other actions include the Actions::TracksCreator module by default which is why the created_by attribute wasn't giving us any issues.
Opening in favor if #15.
Description
The
Actions::RequiresApproval
module is optional for the following actionsAlthough it is an optional module, we were trying to show the
approved_by
attribute in the show views for these actions. We were getting an undefined methodapproved_by
error because the reflection wasn't being declared, and it's only declared when we include the module.When
Actions::RequiresApproval
isn't includedWhen
Actions::RequiresApproval
is includedWhere we declare the reflections
You can see
approved_by
being declared inActions::RequiresApproval
here:https://github.com/bullet-train-pro/bullet_train-action_models/blob/ff7f91e988085778430cd548ca25f6beab8a4925/app/models/concerns/actions/requires_approval.rb#L5
On the other hand, our other actions include the
Actions::TracksCreator
module by default which is why thecreated_by
attribute wasn't giving us any issues.https://github.com/bullet-train-pro/bullet_train-action_models/blob/ff7f91e988085778430cd548ca25f6beab8a4925/app/models/concerns/actions/tracks_creator.rb#L5
Other Changes
I also changed
created_by_id
in the strong params for uniformity.