Class: Decidim::Proposals::VersionsController

Inherits:
ApplicationController show all
Includes:
ApplicationHelper, ResourceVersionsConcern
Defined in:
decidim-proposals/app/controllers/decidim/proposals/versions_controller.rb

Overview

Exposes Proposals versions so users can see how a Proposal/CollaborativeDraft has been updated through time.

Instance Method Summary collapse

Methods inherited from ApplicationController

#proposal_limit, #proposal_limit_reached?, #proposals

Instance Method Details

#versioned_resourceObject


11
12
13
14
15
16
17
18
# File 'decidim-proposals/app/controllers/decidim/proposals/versions_controller.rb', line 11

def versioned_resource
  @versioned_resource ||=
    if params[:proposal_id]
      present(Proposal.where(component: current_component).find(params[:proposal_id]))
    else
      CollaborativeDraft.where(component: current_component).find(params[:collaborative_draft_id])
    end
end