Class: Admin::ContactFormsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::ContactFormsController
- Defined in:
- app/controllers/wafflemix/admin/contact_forms_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
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 37 def create @contact_form = ContactForm.new(params[:contact_form]) respond_to do |format| if @contact_form.save format.html { redirect_to [:admin, @contact_form], notice: 'Contact form was successfully created.' } format.json { render json: @contact_form, status: :created, location: @contact_form } else format.html { render action: "new" } format.json { render json: @contact_form.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 65 def destroy @contact_form = ContactForm.find(params[:id]) @contact_form.destroy respond_to do |format| format.html { redirect_to admin_contact_forms_url } format.json { head :no_content } end end |
#edit ⇒ Object
33 34 35 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 33 def edit @contact_form = ContactForm.find(params[:id]) end |
#index ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 6 def index @contact_forms = ContactForm.all respond_to do |format| format.html format.json { render json: @contact_forms } end end |
#new ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 24 def new @contact_form = ContactForm.new respond_to do |format| format.html format.json { render json: @contact_form } end end |
#show ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 15 def show @contact_form = ContactForm.find(params[:id]) respond_to do |format| format.html format.json { render json: @contact_form } end end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/wafflemix/admin/contact_forms_controller.rb', line 51 def update @contact_form = ContactForm.find(params[:id]) respond_to do |format| if @contact_form.update_attributes(params[:contact_form]) format.html { redirect_to [:admin, @contact_form], notice: 'Contact form was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @contact_form.errors, status: :unprocessable_entity } end end end |