Class: ActiveMetadata::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ActiveMetadata::AttachmentsController
- Defined in:
- app/controllers/active_metadata/attachments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/active_metadata/attachments_controller.rb', line 13 def create @document = params[:model_name].to_class.find(params[:model_id]) @document.(params[:field_name], params[:file], params[:starred], params[:group]) #todo: if errors send back the correct answer respond_to do |format| format.js {render :json => {'success' => true}} end end |
#destroy ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/active_metadata/attachments_controller.rb', line 33 def destroy @document = params[:model_name].to_class.find(params[:model_id]) @document.(params[:id]) #todo: if errors send back the correct answer respond_to do |format| # TODO redirect to index format.js end end |
#index ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/controllers/active_metadata/attachments_controller.rb', line 4 def index @document = params[:model_name].to_class.find(params[:model_id]) @attachments = @document. params[:field_name] respond_to do |format| format.html { render :layout => false} format.xml { render :xml => @histories } end end |
#update ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/active_metadata/attachments_controller.rb', line 23 def update @document = params[:model_name].to_class.find(params[:model_id]) @document.(params[:id],params[:file]) #todo: if errors send back the correct answer respond_to do |format| format.js {render :json => {'success' => true}} end end |