5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 01:21:42 +00:00

el id del sitio puede contener puntos

This commit is contained in:
f 2018-09-27 15:17:10 -03:00
parent b3a7e3c2ea
commit 4c50eb786e
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 4 additions and 9 deletions

View file

@ -56,20 +56,15 @@ class Site
# Obtener el nombre del sitio
def name
@name ||= @jekyll.config['source'].split('/').last
@name ||= File.basename(@jekyll.config['source'])
end
alias :id :name
alias :to_s :name
def name_with_i18n(lang)
[name, lang].join('/')
end
# El id es el sitio sin puntos, para no confundir al routeador de
# rails
def id
@id ||= name.tr('.', '-')
end
alias :to_s :id
def read
@jekyll.read
end

View file

@ -9,7 +9,7 @@ Rails.application.routes.draw do
get '/sites/:site_id/public/:type/:basename', to: 'sites#send_public_file'
resources :sites, only: [ :index, :show ] do
resources :sites, only: [:index, :show], constraints: { site_id: /[^\/]+/, id: /[^\/]+/ } do
resources :posts
resources :templates