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: relations_controller.rb
    path of file: ./repos/openstreetmap-website/app/controllers/api
    
    the code of the file until where you have to start completion: module Api
  class RelationsController < ApiController
    require "xml/libxml"

    before_action :check_api_writable, :only => [:create, :update, :delete]
    before_action :check_api_readable, :except => [:create, :update, :delete]

    
    def relations_for_object(objtype)
      relationids = RelationMember.where(:member_type => objtype, :member_id => params[:id]).collect(&:relation_id).uniq

      @relations = []

      Relation.find(relationids).each do |relation|
        @relations << relation if relation.visible
      end

      # Render the result
      respond_to do |format|
        format.xml
        format.json
      end
    end