You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: messages_controller.rb
    path of file: ./repos/postal/app/controllers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class MessagesController < ApplicationController

  include WithinOrganization

  before_action { @server = orga
    
  def attachment
    if @message.attachments.size > params[:attachment].to_i
      attachment = @message.attachments[params[:attachment].to_i]
      send_data attachment.body, content_type: attachment.mime_type, disposition: "download", filename: attachment.filename
    else
      redirect_to attachments_organization_server_message_path(organization, @server, @message.id), alert: "Attachment not found. Choose an attachment from the list below."
    end