Class: ActiveMetadata::WatchersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/active_metadata/watchers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/active_metadata/watchers_controller.rb', line 16

def create
  @document = eval(params[:model_name]).find params[:model_id]     
  @document.create_watcher_for params[:field_name], User.find(params[:user_id])

  respond_to do |format|
    format.js       
  end
end

#destroyObject



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

def destroy
  @document = eval(params[:model_name]).find params[:model_id]     
  @document.delete_watcher_for params[:field_name], User.find(params[:user_id])
  respond_to do |format|
    format.js       
  end
end

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/active_metadata/watchers_controller.rb', line 5

def index
  @document = eval(params[:model_name]).find params[:model_id]

  @watchers = @document.watchers_for params[:field_name]

  respond_to do |format|
    format.html { render :layout => false}
    format.xml  { render :xml => @watchers }
  end
end