Module: Resourcelogic::Actions::Methods

Defined in:
lib/resourcelogic/actions.rb

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/resourcelogic/actions.rb', line 22

def create
  load_object
  before :create
  if object.save
    after :create
    set_flash :create
    response_for :create
  else
    after :create_fails
    set_flash :create_fails
    response_for :create_fails
  end
end

#destroyObject



57
58
59
60
61
62
63
64
# File 'lib/resourcelogic/actions.rb', line 57

def destroy
  load_object
  before :destroy
  object.destroy
  after :destroy
  set_flash :destroy
  response_for :destroy
end

#editObject



36
37
38
39
40
# File 'lib/resourcelogic/actions.rb', line 36

def edit
  load_object
  before :edit
  response_for :edit
end

#indexObject



74
75
76
77
78
# File 'lib/resourcelogic/actions.rb', line 74

def index
  load_collection
  before :index
  response_for :index
end

#newObject



16
17
18
19
20
# File 'lib/resourcelogic/actions.rb', line 16

def new
  load_object
  before :new_action
  response_for :new_action
end

#showObject



66
67
68
69
70
71
72
# File 'lib/resourcelogic/actions.rb', line 66

def show
  load_object
  before :show
  response_for :show
rescue ActiveRecord::RecordNotFound
  response_for :show_fails
end

#updateObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/resourcelogic/actions.rb', line 42

def update
  load_object
  object.attributes = attributes
  before :update
  if object.save
    after :update
    set_flash :update
    response_for :update
  else
    after :update_fails
    set_flash :update_fails
    response_for :update_fails
  end
end