Open ryanburnette opened 10 years ago
I was thinking about this and realized that the parent/child relationship is further complicated by the routing requirements.
It looks like Self Joins are worth looking into for this.
Actually, nope.
#in config/routes.rb
get '*', to: "my_controller#action"
#in app/controllers/my_controller.rb
def action
path_part = path.split('/')
valid_path = true
path_parts.reverse.each do |part|
if part is not parent
render status: 404
valid_path = false
end
end
raise self
render text: [self.inspect, path_part], headers: {"Content-Type" => "text/html"}, status: "400"
end
#NOTE
gem 'better-errors', group: :development
Pages are going to have the ability to be in a parent/child relationship. I want to be able to arrange them in a hierarchy. I wonder if Rails has a built-in way to manage this relationship, or if I should manually keep track of a parent field for pages then display accordingly.