0

I want to get my Rails3 app to respond to requests for some assets with json. For my application it would be inappropriate to send across all the information relating to a asset though, is there some way to specify fields? I know there's a way in Rails2. Here's some code:

  def index
    @directories = Directory.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @directories }
      format.json { render :json => @directories }
    end
  end
mu is too short
  • 426,620
  • 70
  • 833
  • 800
Sheena
  • 15,590
  • 14
  • 75
  • 113

1 Answers1

1

Answer is a bit outdated however I suppose it will work render :json does not accept options

Community
  • 1
  • 1
Bohdan
  • 8,298
  • 6
  • 41
  • 51