Module: ModMonkey::MerbMonkeyController

Defined in:
lib/modmonkey_client/mod_monkey.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



107
108
109
# File 'lib/modmonkey_client/mod_monkey.rb', line 107

def self.included(base)
  base.show_action("flag", "mm_update")
end

Instance Method Details

#flagObject



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/modmonkey_client/mod_monkey.rb', line 120

def flag
  klass = self.controller_name.singularize.camelize.constantize
  @obj = klass.find(params[:id])
  # we might want to pass in some more args
  @obj.flag(params[:flag])
  if defined?(MerbHasFlash)
    flash[:notice] = MM_FLAG_NOTICE 
    redirect "/"
  else
    redirect "/", :message => {:notice => MM_FLAG_NOTICE}
  end
  
end

#mm_updateObject



111
112
113
114
115
116
117
118
# File 'lib/modmonkey_client/mod_monkey.rb', line 111

def mm_update
  if params[:mod_monkey_item]
    klass = self.controller_name.singularize.camelize.constantize
    @obj = klass.find_by_mm_id_and_mm_key(params[:mod_monkey_item][:id], params[:mod_monkey_item][:item_key])
    @obj.apply_mod_monkey_params( params[:mod_monkey_item] )
    render @obj.to_xml and throw :halt
  end
end