Class: ForumsController
Instance Method Summary
collapse
#advertise, #cache_action?, #css_help, #footer_content, #homepage_features, #plaxo, #rss_site_index, #site_index
#get_matching_ui_locale, #get_sorted_langs_from_accept_header, #get_valid_lang_from_accept_header, #set_locale
#login_by_token, #update_last_seen_at
Instance Method Details
#create ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'app/controllers/forums_controller.rb', line 32
def create
@forum.tag_list = params[:tag_list] || ''
@forum.save!
respond_to do |format|
format.html { redirect_to forums_path }
format.xml { head :created, :location => forum_url(:id => @forum, :format => :xml) }
end
end
|
#destroy ⇒ Object
50
51
52
53
54
55
56
|
# File 'app/controllers/forums_controller.rb', line 50
def destroy
@forum.destroy
respond_to do |format|
format.html { redirect_to forums_path }
format.xml { head 200 }
end
end
|
#index ⇒ Object
9
10
11
12
13
14
15
|
# File 'app/controllers/forums_controller.rb', line 9
def index
@forums = Forum.find(:all, :order => "position")
respond_to do |format|
format.html
format.xml { render :xml => @forums }
end
end
|
#show ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/forums_controller.rb', line 17
def show
respond_to do |format|
format.html do
(session[:forums] ||= {})[@forum.id] = Time.now.utc if logged_in?
@topics = @forum.topics.includes(:replied_by_user).order('sticky DESC, replied_at DESC').page(params[:page]).per(20)
end
format.xml do
render :xml => @forum
end
end
end
|
#update ⇒ Object
41
42
43
44
45
46
47
48
|
# File 'app/controllers/forums_controller.rb', line 41
def update
@forum.tag_list = params[:tag_list] || ''
@forum.update_attributes!(params[:forum])
respond_to do |format|
format.html { redirect_to forums_path }
format.xml { head 200 }
end
end
|