Module: Dry::Controller
- Extended by:
- ActiveSupport::Concern
- Includes:
- RoutingHelpers
- Defined in:
- lib/dry/controller.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary
collapse
#collection_path, #edit_path, #form_arguments, #new_path, #record_path, #relation_path
Instance Method Details
#create ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/dry/controller.rb', line 59
def create
@record = resource_scope.new record_params
if @record.save
redirect_to collection_path(@resource),
notice: "#{model_name.singular.capitalize} was successfully created."
else
render :new
end
end
|
#destroy ⇒ Object
78
79
80
81
82
|
# File 'lib/dry/controller.rb', line 78
def destroy
@record.destroy
redirect_to collection_path(@resource),
notice: "#{model_name.singular.capitalize} was successfully destroyed."
end
|
#edit ⇒ Object
56
57
|
# File 'lib/dry/controller.rb', line 56
def edit
end
|
#index ⇒ Object
46
47
|
# File 'lib/dry/controller.rb', line 46
def index
end
|
#new ⇒ Object
52
53
54
|
# File 'lib/dry/controller.rb', line 52
def new
@record = resource_scope.new
end
|
#show ⇒ Object
49
50
|
# File 'lib/dry/controller.rb', line 49
def show
end
|
#update ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'lib/dry/controller.rb', line 69
def update
if @record.update record_params
redirect_to collection_path(@resource),
notice: "#{model_name.singular.capitalize} was successfully updated."
else
render :edit
end
end
|