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
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/express_admin/standard_actions.rb', line 50 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, layout: defaults[:layout] } end end end |
#destroy ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/express_admin/standard_actions.rb', line 91 def destroy load_resource resource.destroy! respond_to do |format| format.html { redirect_to :index } end end |
#edit ⇒ Object
71 72 73 74 75 76 |
# File 'lib/express_admin/standard_actions.rb', line 71 def edit load_resource respond_to do |format| format.html { render :edit, layout: defaults[:layout] } end end |
#index ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/express_admin/standard_actions.rb', line 35 def index build_resource load_collection respond_to do |format| format.html { render :index, layout: defaults[:layout] } end end |
#new ⇒ Object
43 44 45 46 47 48 |
# File 'lib/express_admin/standard_actions.rb', line 43 def new build_resource respond_to do |format| format.html { render :new, layout: defaults[:layout] } end end |
#show ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/express_admin/standard_actions.rb', line 63 def show load_resource load_collection respond_to do |format| format.html { render :show, layout: defaults[:layout] } end end |
#update ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/express_admin/standard_actions.rb', line 78 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, layout: defaults[:layout] } end end end |