Class Sadmin::AttachmentsController
In: app/controllers/sadmin/attachments_controller.rb
Parent: Sadmin::BaseController

Methods

create   destroy   edit   new   update  

Public Instance methods

[Source]

    # File app/controllers/sadmin/attachments_controller.rb, line 12
12:   def create
13:     @attachment = @document.send(params[:t].pluralize).new({:type => params[:t]}.merge(params[:attachment]))
14:     if @attachment.save
15:       flash[:notice] = t('sadmin.guardado_correctamente', :what => params[:t].camelize.constantize.human_name)
16:       redirect_to sadmin_document_page_url(@document)
17:     else
18:       render :action => "new"
19:     end
20:   end

[Source]

    # File app/controllers/sadmin/attachments_controller.rb, line 37
37:   def destroy
38:     #@attachment = Attachment.find(params[:id])
39:     if @attachment.destroy
40:       flash[:notice] = t('sadmin.eliminado_correctamente', :what => @attachment.class.human_name)
41:     else
42:       flash[:error] = t('sadmin.no_eliminado_correctamente', :what => @attachment.class.human_name)
43:     end
44:     redirect_to sadmin_document_page_url(@attachment.document)
45:   end

[Source]

    # File app/controllers/sadmin/attachments_controller.rb, line 22
22:   def edit
23:     #@attachment = Attachment.find(params[:id])
24:     @title = t('sadmin.modificar_what', :what => @attachment.class.human_name)
25:   end

[Source]

    # File app/controllers/sadmin/attachments_controller.rb, line 7
 7:   def new
 8:     @attachment = @document.send(params[:t].pluralize).new(:type => params[:t])
 9:     @title = t('sadmin.create_what', :what => params[:t].camelize.constantize.human_name)
10:   end

[Source]

    # File app/controllers/sadmin/attachments_controller.rb, line 27
27:   def update
28:     #@attachment = Attachment.find(params[:id])
29:     if @attachment.update_attributes(params[:attachment])
30:       flash[:notice] = t('sadmin.guardado_correctamente', :what => @attachment.class.human_name)
31:       redirect_to sadmin_document_page_url(@attachment.document)
32:     else
33:       render :action => "edit"
34:     end    
35:   end

[Validate]