Class: DiscussionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/discussions_controller.rb

Instance Method Summary collapse

Methods included from Zena::App

included

Instance Method Details

#closeObject

TODO: test



17
18
19
20
21
# File 'app/controllers/discussions_controller.rb', line 17

def close
  get_discussion
  @discussion.update_attributes( :open => false )
  render :action=>'update'
end

#createObject

TODO: test



24
25
26
27
28
29
30
31
# File 'app/controllers/discussions_controller.rb', line 24

def create
  @node = secure(Node) { Node.find(params[:discussion][:node_id])}
  unless @node
    processing_error 'node not found'
  else
    @discussion = Discussion.create(params[:discussion])
  end
end

#openObject

TODO: test



10
11
12
13
14
# File 'app/controllers/discussions_controller.rb', line 10

def open
  get_discussion
  @discussion.update_attributes( :open => true )
  render :action=>'update'
end

#removeObject

TODO: test



34
35
36
37
# File 'app/controllers/discussions_controller.rb', line 34

def remove
  get_discussion
  @discussion.destroy
end

#showObject

TODO: test



4
5
6
7
# File 'app/controllers/discussions_controller.rb', line 4

def show
  get_discussion
  @comments = @discussion.comments
end