Class: ContentController

Inherits:
ApplicationController show all
Defined in:
app/controllers/content_controller.rb

Overview

Gestion des ObjectOffWorld : URL, Media URL, etc.

Ce contrôleur permet la création et la consultation des objets de type ObjectOffWorld.

Instance Method Summary collapse

Instance Method Details

#createObject

Création du nouvel ObjectOffWorld



30
31
32
33
34
35
36
37
38
# File 'app/controllers/content_controller.rb', line 30

def create
  @object_off_world = ObjectOffWorld.new(params[:object_off_world])
  if @object_off_world.save
    flash[:notice] = "Object '#{@object_off_world.name}' was successfully created."
    redirect_to :action => 'list'
  else
    render :action => 'new'
  end
end

#destroyObject

Suppression d’un ObjectOffWorld



57
58
59
60
# File 'app/controllers/content_controller.rb', line 57

def destroy
  ObjectOffWorld.find(params[:id]).destroy
  redirect_to :action => 'list'
end

#editObject

Affichage du formulaire d’édition d’un ObjectOffWorld



41
42
43
# File 'app/controllers/content_controller.rb', line 41

def edit
  @object_off_world = ObjectOffWorld.find(params[:id])
end

#indexObject

Renvoie vers l’action ‘list’



10
11
12
13
# File 'app/controllers/content_controller.rb', line 10

def index
  list
  render :action => 'list'
end

#listObject

Liste les ObjectOffWorld



20
21
22
# File 'app/controllers/content_controller.rb', line 20

def list
  @object_off_world_pages, @objects_off_world = paginate :objects_off_world, :per_page => 10
end

#newObject

Affichage du formulaire de création d’un nouvel ObjectOffWorld



25
26
27
# File 'app/controllers/content_controller.rb', line 25

def new
  @object_off_world = ObjectOffWorld.new
end

#updateObject

Modification d’un ObjectOffWorld



46
47
48
49
50
51
52
53
54
# File 'app/controllers/content_controller.rb', line 46

def update
  @object_off_world = ObjectOffWorld.find(params[:id])
  if @object_off_world.update_attributes(params[:object_off_world])
    flash[:notice] = "Object '#{@object_off_world.name}' was successfully updated."
    redirect_to :action => 'list'
  else
    render :action => 'edit'
  end
end