diff --git a/app/controllers/federal_subjects_controller.rb b/app/controllers/federal_subjects_controller.rb index a00e205..5cd42d3 100644 --- a/app/controllers/federal_subjects_controller.rb +++ b/app/controllers/federal_subjects_controller.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -class CountryStatesController < ApplicationController +class FederalSubjectsController < ApplicationController before_action :set_country_state, except: :index # GET /country_states def index authorize :country_state - @country_states = policy_scope(CountryState) + @country_states = policy_scope(FederalSubject) end # GET /country_states/:id @@ -17,6 +17,6 @@ class CountryStatesController < ApplicationController private def set_country_state - @country_state = CountryState.find params[:id] + @country_state = FederalSubject.find params[:id] end end diff --git a/app/models/federal_subject.rb b/app/models/federal_subject.rb index 30baec2..f003f8e 100644 --- a/app/models/federal_subject.rb +++ b/app/models/federal_subject.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CountryState < ApplicationRecord +class FederalSubject < ApplicationRecord ################ # Associations # ################ diff --git a/app/policies/federal_subject_policy.rb b/app/policies/federal_subject_policy.rb index 798a657..08e2199 100644 --- a/app/policies/federal_subject_policy.rb +++ b/app/policies/federal_subject_policy.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CountryStatePolicy < ApplicationPolicy +class FederalSubjectPolicy < ApplicationPolicy def index? true end diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb index 7901118..c9a32e8 100644 --- a/app/views/application/_navbar.html.erb +++ b/app/views/application/_navbar.html.erb @@ -18,7 +18,7 @@ <% if policy(:country_state).index? %> <% end %> diff --git a/app/views/federal_subjects/index.html.erb b/app/views/federal_subjects/index.html.erb index 1fdba14..6899549 100644 --- a/app/views/federal_subjects/index.html.erb +++ b/app/views/federal_subjects/index.html.erb @@ -3,10 +3,10 @@ - <%= CountryState.human_attribute_name :english_name %> + <%= FederalSubject.human_attribute_name :english_name %> - <%= CountryState.human_attribute_name :native_name %> + <%= FederalSubject.human_attribute_name :native_name %> diff --git a/db/seeds.rb b/db/seeds.rb index 78864f3..9618739 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,8 +9,8 @@ CSV.foreach country_states_filename, native_name.strip! english_name.strip! - CountryState.where(english_name: english_name) - .first_or_create! do |new_country_state| + FederalSubject.where(english_name: english_name) + .first_or_create! do |new_country_state| new_country_state.native_name = native_name end end diff --git a/factories/federal_subjects.rb b/factories/federal_subjects.rb index 734da7d..f4f96d1 100644 --- a/factories/federal_subjects.rb +++ b/factories/federal_subjects.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :country_state do initialize_with do - CountryState.find_or_initialize_by english_name: english_name + FederalSubject.find_or_initialize_by english_name: english_name end english_name do diff --git a/spec/models/federal_subject_spec.rb b/spec/models/federal_subject_spec.rb index 96014cf..9323dbc 100644 --- a/spec/models/federal_subject_spec.rb +++ b/spec/models/federal_subject_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe CountryState do +RSpec.describe FederalSubject do subject { create :country_state } it do diff --git a/spec/policies/federal_subject_policy_spec.rb b/spec/policies/federal_subject_policy_spec.rb index 87b4882..173a30f 100644 --- a/spec/policies/federal_subject_policy_spec.rb +++ b/spec/policies/federal_subject_policy_spec.rb @@ -2,11 +2,11 @@ require 'rails_helper' -RSpec.describe CountryStatePolicy do +RSpec.describe FederalSubjectPolicy do subject { described_class.new current_account, record } let :resolved_scope do - described_class::Scope.new(current_account, CountryState.all).resolve + described_class::Scope.new(current_account, FederalSubject.all).resolve end let!(:record) { create :country_state } @@ -20,7 +20,7 @@ RSpec.describe CountryStatePolicy do it { is_expected.to forbid_edit_and_update_actions } it { is_expected.to forbid_action :destroy } - specify { expect(resolved_scope).to eq CountryState.all } + specify { expect(resolved_scope).to eq FederalSubject.all } specify { expect(resolved_scope).to include record } specify { expect(resolved_scope).to include other_record }