Sha256: b5117b2dcc4d701b0e1e4d932d52d448663b5822572fadcdd5878a1e5978eff1
Contents?: true
Size: 760 Bytes
Versions: 6
Compression:
Stored size: 760 Bytes
Contents
class CategoriesController < ApplicationController def index @categories = Category.all end def new @category = Category.new end def create @category = Category.new(params[:category]) if @category.save redirect_to categories_path else render :new end end def edit @category = Category.find(params[:id]) end def update @category = Category.find(params[:id]) if @category.update_attributes(params[:category]) redirect_to categories_path else render :edit end end def token @categories = Category.where("categories.name like ?", "%#{params[:q]}%") respond_to do |format| format.json { render :json => Category.token_json(@categories) } end end end
Version data entries
6 entries across 6 versions & 1 rubygems