From 8d46fe784329545b920d059620ec9ded8201a41a Mon Sep 17 00:00:00 2001 From: nilsding Date: Mon, 10 Nov 2014 13:03:42 +0100 Subject: [PATCH] added ajax controller --- app/controllers/ajax_controller.rb | 4 ++++ app/helpers/ajax_helper.rb | 2 ++ app/views/ajax/ask.json.jbuilder | 3 +++ test/controllers/ajax_controller_test.rb | 9 +++++++++ test/helpers/ajax_helper_test.rb | 4 ++++ 5 files changed, 22 insertions(+) create mode 100644 app/controllers/ajax_controller.rb create mode 100644 app/helpers/ajax_helper.rb create mode 100644 app/views/ajax/ask.json.jbuilder create mode 100644 test/controllers/ajax_controller_test.rb create mode 100644 test/helpers/ajax_helper_test.rb diff --git a/app/controllers/ajax_controller.rb b/app/controllers/ajax_controller.rb new file mode 100644 index 00000000..a93817b1 --- /dev/null +++ b/app/controllers/ajax_controller.rb @@ -0,0 +1,4 @@ +class AjaxController < ApplicationController + def ask + end +end diff --git a/app/helpers/ajax_helper.rb b/app/helpers/ajax_helper.rb new file mode 100644 index 00000000..3f1a4867 --- /dev/null +++ b/app/helpers/ajax_helper.rb @@ -0,0 +1,2 @@ +module AjaxHelper +end diff --git a/app/views/ajax/ask.json.jbuilder b/app/views/ajax/ask.json.jbuilder new file mode 100644 index 00000000..a027dbff --- /dev/null +++ b/app/views/ajax/ask.json.jbuilder @@ -0,0 +1,3 @@ +json.success @success +json.status @status +json.message @message \ No newline at end of file diff --git a/test/controllers/ajax_controller_test.rb b/test/controllers/ajax_controller_test.rb new file mode 100644 index 00000000..899107b0 --- /dev/null +++ b/test/controllers/ajax_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class AjaxControllerTest < ActionController::TestCase + test "should get ask" do + get :ask + assert_response :success + end + +end diff --git a/test/helpers/ajax_helper_test.rb b/test/helpers/ajax_helper_test.rb new file mode 100644 index 00000000..c44c5ca4 --- /dev/null +++ b/test/helpers/ajax_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class AjaxHelperTest < ActionView::TestCase +end