Skip to content

Instantly share code, notes, and snippets.

@veganstraightedge
Created April 25, 2010 02:44
Show Gist options
  • Save veganstraightedge/378119 to your computer and use it in GitHub Desktop.
Save veganstraightedge/378119 to your computer and use it in GitHub Desktop.
class PlantsController < ApplicationController
respond_to :html, :json, :xml, :csv, :yaml, :txt
def index
if params[:q]
@plants = Plant.search(params[:q]).paginate(:page => params[:page], :per_page => 50)
else
@plants = Plant.paginate(:page => params[:page], :per_page => 50)
end
respond_with @plants
end
def show
@plant = Plant.find(params[:id])
respond_with @plant
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment