Class: Admin::CustomTextsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::CustomTextsController
- Defined in:
- app/controllers/admin/custom_texts_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 33 def create @custom_text = CustomText.new(params[:custom_text]) respond_to do |format| if @custom_text.save flash[:notice] = 'Custom text successfully created' format.html { redirect_to admin_custom_text_path(@custom_text) } else flash[:error] = 'Problems creating your new custom text' format.html { render action: :new } end end end |
#destroy ⇒ Object
57 58 59 60 61 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 57 def destroy custom_text = CustomText.find(params[:id]) flash[:notice] = custom_text.destroy ? 'Custom text deleted' : 'Failed to destroy custom text' redirect_to admin_custom_texts_url end |
#edit ⇒ Object
29 30 31 32 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 29 def edit @custom_text = CustomText.find(params[:id]) respond_to { |format| format.html } end |
#index ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 8 def index @custom_texts = CustomText.all respond_to do |format| format.html format.xml { render xml: @custom_texts.to_xml } end end |
#new ⇒ Object
25 26 27 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 25 def new @custom_text = CustomText.new end |
#show ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 17 def show @custom_text = CustomText.find(params[:id]) respond_to do |format| format.html format.xml { render xml: @custom_text.to_xml } end end |
#update ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/admin/custom_texts_controller.rb', line 46 def update @custom_text = CustomText.find(params[:id]) if @custom_text.update(params[:custom_text]) flash[:notice] = 'Details have been updated' redirect_to admin_custom_text_path(@custom_text) else flash[:error] = 'Failed to update attributes' render action: 'edit', id: @custom_text.id end end |