diff --git a/app/models/decidim/budgets_paper_ballots/paper_ballot_result.rb b/app/models/decidim/budgets_paper_ballots/paper_ballot_result.rb index 09abe76..951fa26 100644 --- a/app/models/decidim/budgets_paper_ballots/paper_ballot_result.rb +++ b/app/models/decidim/budgets_paper_ballots/paper_ballot_result.rb @@ -2,6 +2,8 @@ module Decidim module BudgetsPaperBallots # The data store for a paper ballot result in the Budget resource. class PaperBallotResult < Budgets::ApplicationRecord + include Decidim::Resourceable + self.table_name = "decidim_budgets_paper_ballot_results" belongs_to :project, class_name: "Decidim::Budgets::Project", foreign_key: "decidim_project_id" end diff --git a/config/locales/en.yml b/config/locales/en.yml index 7a98374..0a4efc2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -15,7 +15,7 @@ en: paper_ballots: Paper ballots imports: help: - paper_ballot_results: "The import document should contain the following columns: id (with the project's id) and paper_ballots_to_import (with the number of new votes for the project that should be imported). You can simply reuse an export of all the projects and add a column named 'paper_ballots_to_import'." + paper_ballot_results: "The import document should contain the following columns: 'id' (with the project's id) and 'paper_ballots_to_import' (with the number of new votes for the project that should be imported). You can simply reuse an export of all the projects and add a column named 'paper_ballots_to_import'." label: paper_ballot_results: Import paper ballots resources: diff --git a/lib/decidim/budgets_paper_ballots/engine.rb b/lib/decidim/budgets_paper_ballots/engine.rb index 0418e63..f617cf1 100644 --- a/lib/decidim/budgets_paper_ballots/engine.rb +++ b/lib/decidim/budgets_paper_ballots/engine.rb @@ -4,7 +4,7 @@ require "decidim/core" require "decidim/budgets" require "decidim/budgets_paper_ballots/import" -require "decidim/budgets_paper_ballots/project_serializer" +require "decidim/budgets_paper_ballots/project_serializer_override" module Decidim module BudgetsPaperBallots @@ -32,6 +32,12 @@ class Engine < ::Rails::Engine end end end + + initializer "budgets_paper_ballots.register_resources" do + Decidim.register_resource(:paper_ballot_result) do |resource| + resource.model_class_name = "Decidim::BudgetsPaperBallots::PaperBallotResult" + end + end end end end diff --git a/lib/decidim/budgets_paper_ballots/project_serializer.rb b/lib/decidim/budgets_paper_ballots/project_serializer_override.rb similarity index 100% rename from lib/decidim/budgets_paper_ballots/project_serializer.rb rename to lib/decidim/budgets_paper_ballots/project_serializer_override.rb