Module: ExpressAdmin::StandardActions::InstanceMethods
- Defined in:
- lib/express_admin/standard_actions.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/express_admin/standard_actions.rb', line 101 def create build_resource(resource_params) if resource.save respond_to do |format| format.html { redirect_to resource_path } end else respond_to do |format| format.html { render new_view, layout: defaults[:layout] } end end end |
#destroy ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/express_admin/standard_actions.rb', line 142 def destroy load_resource resource.destroy! respond_to do |format| format.html { redirect_to collection_path } end end |
#edit ⇒ Object
122 123 124 125 126 127 |
# File 'lib/express_admin/standard_actions.rb', line 122 def edit load_resource respond_to do |format| format.html { render edit_view, layout: defaults[:layout] } end end |
#index ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/express_admin/standard_actions.rb', line 86 def index build_resource load_collection respond_to do |format| format.html { render index_view, layout: defaults[:layout] } end end |
#new ⇒ Object
94 95 96 97 98 99 |
# File 'lib/express_admin/standard_actions.rb', line 94 def new build_resource respond_to do |format| format.html { render new_view, layout: defaults[:layout] } end end |
#show ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/express_admin/standard_actions.rb', line 114 def show load_resource load_collection respond_to do |format| format.html { render show_view, layout: defaults[:layout] } end end |
#update ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/express_admin/standard_actions.rb', line 129 def update load_resource if resource.update_attributes(resource_params) respond_to do |format| format.html { redirect_to resource_path } end else respond_to do |format| format.html { render edit_view, layout: defaults[:layout] } end end end |