In Rails 3, given routes, for example
get 'about/terms', :as => 'terms' get 'about/privacy', :as => 'privacy' get 'about/jobs', :as => 'career' get 'about/feedback', :as => 'feedback' get 'about/contact', :as => 'contact' get 'about/us', :as => 'about'
How to dry it?
Repeat something like this:
['terms', 'privacy', 'jobs', 'feedback', 'contact' ,'us'].each { |r| get "about/#{r}", :as => r }
if about is a controller or you hava controller for your static pages
['terms', 'privacy', 'jobs', 'feedback', 'contact' ,'us'].each { |r| get "/#{r}", :controller => 'about', :action => r }
Source: https://habr.com/ru/post/1779727/More articles:Create a new data type in JavaScript - javascriptFailed to start Intent service in my Android program, what's wrong? - androidAndroid background sensor data collector - androidКак я могу (во время компиляции) определить, является ли typename именем указателя функции? - c++получение чисел, введенных в текстовое поле в массиве - arrayshow to apply color in text message in warning dialog in android - androidclassic one-to-many diagram - visual-studioStatic classes that require the Initialization method to be called previously used - is everything all right? - c #using a generic method instead of a method parameter - genericspython refcounts - pythonAll Articles