|
Revision 245, 0.9 kB
(checked in by jk, 1 year ago)
|
#171 - :remote now is true by default; fixes to demo app
|
| Line | |
|---|
| 1 |
class ContentsController < ApplicationController |
|---|
| 2 |
before_filter :find_content, :only => [ :show, :edit, :update, :destroy ] |
|---|
| 3 |
|
|---|
| 4 |
def index |
|---|
| 5 |
@contents = Content.paginate :page => params[:page] |
|---|
| 6 |
end |
|---|
| 7 |
|
|---|
| 8 |
def show |
|---|
| 9 |
end |
|---|
| 10 |
|
|---|
| 11 |
def new |
|---|
| 12 |
@content = Content.new |
|---|
| 13 |
end |
|---|
| 14 |
|
|---|
| 15 |
def create |
|---|
| 16 |
@content = Content.new(params[:content]) |
|---|
| 17 |
if @content.save |
|---|
| 18 |
flash[:notice] = 'Content was successfully created.' |
|---|
| 19 |
redirect_to contents_url |
|---|
| 20 |
else |
|---|
| 21 |
render :action => 'new' |
|---|
| 22 |
end |
|---|
| 23 |
logger.error "#############{@content.errors.full_messages}" |
|---|
| 24 |
end |
|---|
| 25 |
|
|---|
| 26 |
def edit |
|---|
| 27 |
end |
|---|
| 28 |
|
|---|
| 29 |
def update |
|---|
| 30 |
if @content.update_attributes(params[:content]) |
|---|
| 31 |
flash[:notice] = 'Content was successfully updated.' |
|---|
| 32 |
redirect_to :action => 'show', :id => @content |
|---|
| 33 |
else |
|---|
| 34 |
render :action => 'edit' |
|---|
| 35 |
end |
|---|
| 36 |
end |
|---|
| 37 |
|
|---|
| 38 |
def destroy |
|---|
| 39 |
@content.destroy |
|---|
| 40 |
redirect_to :action => 'list' |
|---|
| 41 |
end |
|---|
| 42 |
|
|---|
| 43 |
protected |
|---|
| 44 |
|
|---|
| 45 |
def find_content |
|---|
| 46 |
@content = Content.find params[:id] |
|---|
| 47 |
end |
|---|
| 48 |
|
|---|
| 49 |
end |
|---|