views:

10

answers:

0

I would like to render a hash into json, where elements in the json array are the result of link_to some_path(@object) calls and such, and am wondering how to do this the Rails way.

class PostController
  def index
    @posts = Post.to_flexigrid(params)
    # @posts == {:page => 1, :count => 102, :rows => [{:cell => #<Post...>}...]}.to_flexigrid
    respond_with(@posts) do |format|
      format.flexigrid { render :flexigrid => @posts.to_flexigrid }
    end
  end
end

Is there some way to make one of those work?