Module: Weeler::ActionController::Acts::Restful::InstanceMethodsOnActivation
- Defined in:
- lib/weeler/action_controller/acts/restful.rb
Overview
These methods only activate if ‘acts_as_restful’ is called
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #order ⇒ Object
- #remove_image ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 83 def create @item = model.new(items_params) if @item.save after_create_action else render :action => 'new' end end |
#destroy ⇒ Object
100 101 102 103 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 100 def destroy @item.destroy after_destroy_action end |
#edit ⇒ Object
75 76 77 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 75 def edit load_translations end |
#index ⇒ Object
60 61 62 63 64 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 60 def index @paginate = paginate @items = load_collection @items = @items.page(params[:page]).per(@paginate) if @paginate.present? && @paginate > 0 end |
#new ⇒ Object
66 67 68 69 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 66 def new @item = model.new load_translations end |
#order ⇒ Object
79 80 81 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 79 def order sort end |
#remove_image ⇒ Object
105 106 107 108 109 110 111 112 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 105 def remove_image if @item.image.present? @item.image.destroy @item.image_file_name = nil @item.save end redirect_to({ action: :edit, id: @item.id}, {:notice => "Image successfully removed"}) end |
#show ⇒ Object
71 72 73 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 71 def show render :edit end |
#update ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/weeler/action_controller/acts/restful.rb', line 92 def update if @item.update(items_params) after_update_action else render :action => 'edit' end end |