다음과 같이 하면 됩니다.
cd /var/discourse
./launcher enter app
rails c
이렇게 하면 콘솔에 접근할 수 있습니다. 그런 다음 do stuff를 실행하면 됩니다.
이 명령들이 무엇인지 이해하지 못한다면, 직접 실행하는 것을 권장하지 않습니다.
아래는 2018년 1월 12일경에 작동했던 것으로 믿는 스크립트입니다. 반드시 작동한다고 보장할 수는 없지만, 작동하지 않을 이유는 없다고 봅니다. 백업을 꼭 취하고, 촛불을 켜두세요. ![]()
# 검색어와 일치하는 모든 카테고리 및 하위 카테고리를 알파벳 순으로 정렬
def sort_matching_categories_and_subcategories(search)
categories = Category.where("name like ?", search)
position = 100
categories.order(:name).each do |cat|
position += 5
cat.position = position
cat.save!()
c_position = 0
children = Category.where(:parent_category_id=>cat.id)
children.order(:name).each do |c|
c_position += 5
c.position = c_position
c.save!()
end
end
end
# 검색어와 일치하는 단일 카테고리의 하위 카테고리를 알파벳 순으로 정렬
def sort_matching_subcategories(search)
categories = Category.where("name like ?", search)
if categories.count > 1
puts "Found more than one category"
end
categories.order(:name).each do |cat|
c_position = 5
children = Category.where(:parent_category_id=>cat.id)
children.order(:name).each do |c|
c_position += 5
c.position = c_position
c.save!()
end
end
end
더 많은 도움이 필요하고 예산이 있다면 Redirecting… 을 참조하거나 저에게 이메일을 보내주세요.
도움이 되길 바랍니다!