Skip to content

Commit 077473f

Browse files
committed
Fix ruby-china#221 Feed 的 Headers Content-Type 描述修正;
1 parent 28191e3 commit 077473f

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

app/controllers/topics_controller.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def index
1515

1616
def feed
1717
@topics = Topic.recent.without_body.limit(20).includes(:node,:user, :last_reply_user)
18-
response.headers['Content-Type'] = 'application/rss+xml; charset=utf-8'
1918
render :layout => false
2019
end
2120

@@ -30,7 +29,6 @@ def node
3029
def node_feed
3130
@node = Node.find(params[:id])
3231
@topics = @node.topics.recent.without_body.limit(20)
33-
response.headers["Content-Type"] = "application/rss+xml"
3432
render :layout => false
3533
end
3634

config/locales/topics.zh-CN.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
reply_this_fllor: "回复此楼"
1111
tips_for_create_topic: "发帖说明"
1212
start_a_new_topic_button: "发布新帖"
13-
subscribe_with_rss: "订阅%{name}社区新帖"
13+
subscribe_with_rss: "订阅 %{name} 社区新帖"
1414
submit_reply: "提交回复"
1515
topic_list:
1616
hot_topic: "活跃帖子"

config/routes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
resources :nodes
3939

4040
get "topics/node:id" => "topics#node", as: 'node_topics'
41-
get "topics/node:id/feed" => "topics#node_feed", as: 'feed_node_topics'
41+
get "topics/node:id/feed" => "topics#node_feed", as: 'feed_node_topics', defaults: { format: 'xml' }
4242
get "topics/last" => "topics#recent", as: 'recent_topics'
4343
resources :topics do
4444
member do
@@ -53,7 +53,7 @@
5353
get :no_reply
5454
get :popular
5555
get :excellent
56-
get :feed
56+
get :feed, defaults: { format: 'xml' }
5757
post :preview
5858
end
5959
resources :replies

spec/controllers/topics_controller_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
describe ":feed" do
1818
it "should have a feed action" do
1919
get :feed
20+
response.headers['Content-Type'].should == 'application/xml; charset=utf-8'
2021
response.should be_success
2122
end
2223
end

0 commit comments

Comments
 (0)