1 class ThumbsController < ApplicationController
2 include AuthenticatedSystem
4 before_filter :login_required, :only => [ :new, :edit, :create, :update, :destroy ]
9 @search = Thumb::Search.new(params[:search])
10 @thumbs = Thumb.search(@search).paginate([ '_id' ], :size => 30, :page => params[:page])
12 respond_to do |format|
13 format.html # index.html.erb
14 format.xml { render :xml => @thumbs }
21 @thumb = Thumb.find(params[:id])
23 respond_to do |format|
24 format.html # show.html.erb
25 format.xml { render :xml => @thumb }
32 @thumb = Record::Thumb.new
34 respond_to do |format|
35 format.html # new.html.erb
36 format.xml { render :xml => @thumb }
42 @thumb = Record::Thumb.find(params[:id])
48 @thumb = Record::Thumb.new(params[:thumb])
49 @thumb.video_id = params[:thumb].delete(:video_id)
51 respond_to do |format|
53 flash[:notice] = 'Record::Thumb was successfully created.'
54 format.html { redirect_to(@thumb) }
55 format.xml { render :xml => @thumb, :status => :created, :location => @thumb }
57 format.html { render :action => "new" }
58 format.xml { render :xml => @thumb.errors, :status => :unprocessable_entity }
66 @thumb = Record::Thumb.find(params[:id])
68 respond_to do |format|
69 if @thumb.update_attributes(params[:thumb])
70 flash[:notice] = 'Record::Thumb was successfully updated.'
71 format.html { redirect_to(@thumb) }
72 format.xml { head :ok }
74 format.html { render :action => "edit" }
75 format.xml { render :xml => @thumb.errors, :status => :unprocessable_entity }
81 # DELETE /thumbs/1.xml
83 @thumb = Record::Thumb.find(params[:id])
86 respond_to do |format|
87 format.html { redirect_to(thumbs_url) }
88 format.xml { head :ok }