class Admin::VelodromesController

All succcessful edit expire cache.

Public Instance Methods

create() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 15
def create
  expire_cache
  @velodrome = Velodrome.create(params[:velodrome])
  
  if @velodrome.errors.empty?
    flash[:notice] = "Created #{@velodrome.name}"
    return redirect_to(new_admin_velodrome_path)
  end
  render(:template => 'admin/velodromes/edit')
end
destroy() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 53
def destroy
  @velodrome = Velodrome.find(params[:id])
  flash[:notice] = "Deleted #{@velodrome.name}"
  @velodrome.destroy
  redirect_to(admin_velodromes_path)
  expire_cache
end
edit() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 26
def edit
  @velodrome = Velodrome.find(params[:id])
end
index() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 6
def index
  @velodromes = Velodrome.all( :order => "name")
end
new() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 10
def new
  @velodrome = Velodrome.new
  render :action => "edit"
end
update() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 30
def update
  expire_cache
  @velodrome = Velodrome.find(params[:id])
  
  if @velodrome.update_attributes(params[:velodrome])
    flash[:notice] = "Updated #{@velodrome.name}"
    return redirect_to(edit_admin_velodrome_path(@velodrome))
  end
  render(:template => 'admin/velodromes/edit')
end
update_attribute() click to toggle source
# File app/controllers/admin/velodromes_controller.rb, line 41
def update_attribute
  respond_to do |format|
    format.js {
      @velodrome = Velodrome.find(params[:id])
      @velodrome.send "#{params[:name]}=", params[:value]
      @velodrome.save!
      expire_cache
      render :text => @velodrome.send(params[:name]), :content_type => "text/html"
    }
  end
end