Class: ForumsController
Instance Method Summary
collapse
#advertise, #cache_action?, #footer_content, #homepage_features, #plaxo, #rss_site_index, #site_index
Methods included from BaseHelper
#add_friend_link, #ajax_spinner_for, #avatar_for, #block_to_partial, #box, #city_cloud, #clippings_link, #commentable_url, #container_title, #excerpt_with_jump, #flash_class, #forum_page?, #is_current_user_and_featured?, #jumbotron, #last_active, #more_comments_links, #page_title, #paginating_links, #possesive, #profile_completeness, #render_jumbotron, #render_widgets, #rounded, #search_posts_title, #search_user_posts_path, #show_footer_content?, #tag_auto_complete_field, #time_ago_in_words, #time_ago_in_words_or_date, #topnav_tab, #truncate_words, #truncate_words_with_highlight, #widget
#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
40
|
# File 'app/controllers/forums_controller.rb', line 32
def create
@forum = Forum.new(forum_params)
@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
56
57
58
59
60
61
62
63
|
# File 'app/controllers/forums_controller.rb', line 56
def destroy
@forum = Forum.find(params[:id])
@forum.destroy
respond_to do |format|
format.html { redirect_to forums_path }
format.xml { head 200 }
end
end
|
#edit ⇒ Object
42
43
44
|
# File 'app/controllers/forums_controller.rb', line 42
def edit
@forum = Forum.find(params[:id])
end
|
#index ⇒ Object
4
5
6
7
8
9
10
|
# File 'app/controllers/forums_controller.rb', line 4
def index
@forums = Forum.order("position")
respond_to do |format|
format.html
format.xml { render :xml => @forums }
end
end
|
#new ⇒ Object
28
29
30
|
# File 'app/controllers/forums_controller.rb', line 28
def new
@forum = Forum.new
end
|
#show ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/forums_controller.rb', line 12
def show
@forum = Forum.find(params[:id])
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
46
47
48
49
50
51
52
53
54
|
# File 'app/controllers/forums_controller.rb', line 46
def update
@forum = Forum.find(params[:id])
@forum.tag_list = params[:tag_list] || ''
@forum.update_attributes!(forum_params)
respond_to do |format|
format.html { redirect_to forums_path }
format.xml { head 200 }
end
end
|