Skip to content

Commit 7ab5f45

Browse files
authored
Data import (#86)
2 parents fbbd2e0 + 6ad6f7f commit 7ab5f45

19 files changed

+22423
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ db/structure.sql
3737

3838
# Ignore IDE config files
3939
.idea/
40+
.DS_Store

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ gem "jbuilder"
2020
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
2121
gem "bcrypt", "~> 3.1.7"
2222

23+
gem "csv"
24+
2325
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
2426
gem "tzinfo-data", platforms: %i[ windows jruby ]
2527

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ GEM
105105
concurrent-ruby (1.3.5)
106106
connection_pool (2.5.0)
107107
crass (1.0.6)
108+
csv (3.3.2)
108109
date (3.4.1)
109110
debug (1.10.0)
110111
irb (~> 1.10)
@@ -436,6 +437,7 @@ DEPENDENCIES
436437
brakeman
437438
bullet
438439
capybara
440+
csv
439441
debug
440442
factory_bot_rails
441443
faker

app/models/language.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Language < ApplicationRecord
2+
has_many :topics, dependent: :destroy
23
validates :name, presence: true, uniqueness: true, length: { minimum: 2 }
34

45
def file_storage_prefix

app/models/region.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Region < ApplicationRecord
2-
has_many :branches
2+
has_many :branches, dependent: :destroy
33
has_many :providers, through: :branches
44

55
validates :name, presence: true

app/views/layouts/application.html.erb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/compiled/css/app.css">
2727
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/compiled/css/app-dark.css">
2828
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/compiled/css/iconly.css">
29-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/extensions/simple-datatables/style.css">
30-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/scss/pages/simple-datatables.scss">
3129

3230
<style>
3331
#app {
@@ -91,8 +89,5 @@
9189
</footer>
9290
</div>
9391
</div>
94-
95-
<script src="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/extensions/simple-datatables/umd/simple-datatables.js"></script>
96-
<script src="https://cdn.jsdelivr.net/gh/zuramai/mazer@docs/demo/assets/static/js/pages/simple-datatables.js"></script>
9792
</body>
9893
</html>

app/views/topics/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<% @topics.each do |topic| %>
3232
<tr>
3333
<td class="text-bold-500"><%= topic.title %></td>
34-
<td class="text-bold-500"><%= topic.description.truncate(25, omission: "...") %></td>
34+
<td class="text-bold-500"><%= topic.description.truncate(25, omission: "...") unless topic.description.blank? %></td>
3535
<td class="text-bold-500"><%= topic.uid.truncate(10, omission: "...") %></td>
3636
<td class="text-bold-500"><%= topic.language.name %></td>
3737
<td class="text-bold-500"><%= topic.provider.name %></td>

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ class Application < Rails::Application
2222
# in config/environments, which are processed later.
2323
#
2424
# config.time_zone = "Central Time (US & Canada)"
25-
# config.eager_load_paths << Rails.root.join("extras")
25+
config.eager_load_paths << Rails.root.join("lib/autorequire")
2626
end
2727
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddOldIdToProviders < ActiveRecord::Migration[8.0]
2+
def change
3+
add_column :providers, :old_id, :integer
4+
add_index :providers, :old_id, unique: true
5+
end
6+
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddOldIdToTopics < ActiveRecord::Migration[8.0]
2+
def change
3+
add_column :topics, :old_id, :integer
4+
add_index :topics, :old_id, unique: true
5+
end
6+
end

0 commit comments

Comments
 (0)