diff --git a/app/assets/javascripts/sites.js.coffee b/app/assets/javascripts/custom_urls.js.coffee similarity index 100% rename from app/assets/javascripts/sites.js.coffee rename to app/assets/javascripts/custom_urls.js.coffee diff --git a/app/controllers/sites_controller.rb b/app/controllers/custom_urls_controller.rb similarity index 67% rename from app/controllers/sites_controller.rb rename to app/controllers/custom_urls_controller.rb index f55fbb0..49d9a07 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/custom_urls_controller.rb @@ -1,4 +1,4 @@ -class SitesController < ApplicationController +class CustomUrlsController < ApplicationController def administrate end diff --git a/app/models/site.rb b/app/models/custom_url.rb similarity index 82% rename from app/models/site.rb rename to app/models/custom_url.rb index eb4760d..1617271 100644 --- a/app/models/site.rb +++ b/app/models/custom_url.rb @@ -1,4 +1,4 @@ -class Site < ActiveRecord::Base +class CustomUrl < ActiveRecord::Base belongs_to :article attr_accessible :name diff --git a/app/views/sites/administrate.html.erb b/app/views/CustomUrls/administrate.html.erb similarity index 100% rename from app/views/sites/administrate.html.erb rename to app/views/CustomUrls/administrate.html.erb diff --git a/config/routes.rb b/config/routes.rb index 6eeed0e..de07ff0 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,7 +75,7 @@ Ensl::Application.routes.draw do resources :weeks resources :movies resources :messages - resources :sites + # resources :sites resources :bans resources :tweets resources :issues @@ -136,10 +136,10 @@ Ensl::Application.routes.draw do match "votes/create" match "polls/showvotes/:id", to: "polls#showvotes", as: "polls_showvotes" - get "sites/administrate" - resource :sites, only: [:create, :update, :destroy] + get "CustomUrls/administrate" + resources :custom_urls, only: [:create, :update, :destroy] - get ":name", requirements: {name: /\A[a-z\-]{2,10}\Z/} + get ":name", to: "custom_urls#show", requirements: {name: /\A[a-z\-]{2,10}\Z/} match ":controller/:action", requirements: { action: /A-Za-z/ } match ":controller/:action/:id" diff --git a/db/migrate/20171109165433_create_custom_urls.rb b/db/migrate/20171109165433_create_custom_urls.rb new file mode 100644 index 0000000..a211040 --- /dev/null +++ b/db/migrate/20171109165433_create_custom_urls.rb @@ -0,0 +1,12 @@ +class CreateCustomUrls < ActiveRecord::Migration + def change + create_table :custom_urls do |t| + t.string :name + t.references :article + + t.timestamps + end + add_index :custom_urls, :name + add_index :custom_urls, :article_id + end +end diff --git a/db/migrate/20171109165433_create_sites.rb b/db/migrate/20171109165433_create_sites.rb deleted file mode 100644 index 8bfb753..0000000 --- a/db/migrate/20171109165433_create_sites.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateSites < ActiveRecord::Migration - def change - create_table :sites do |t| - t.string :name - t.references :article - - t.timestamps - end - add_index :sites, :name - add_index :sites, :article_id - end -end diff --git a/db/schema.rb b/db/schema.rb index a960534..d2a0577 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20171013154050) do +ActiveRecord::Schema.define(:version => 20171109165433) do create_table "admin_requests", :force => true do |t| t.string "addr" @@ -199,6 +199,16 @@ ActiveRecord::Schema.define(:version => 20171013154050) do add_index "contests_maps", ["contest_id", "map_id"], :name => "index_contests_maps_on_contest_id_and_map_id" add_index "contests_maps", ["map_id", "contest_id"], :name => "index_contests_maps_on_map_id_and_contest_id" + create_table "custom_urls", :force => true do |t| + t.string "name" + t.integer "article_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "custom_urls", ["article_id"], :name => "index_custom_urls_on_article_id" + add_index "custom_urls", ["name"], :name => "index_custom_urls_on_name" + create_table "data_files", :force => true do |t| t.string "name" t.string "description"