From 5afdad5a7662834028ccc9e6f7ab23ddd456e3d7 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 18:57:02 -0500 Subject: [PATCH 01/20] Connect phone start --- config/routes.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 4f69d16..b902894 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,4 +7,8 @@ match 'auth/:provider/callback', to: 'sessions#create', via: [:get, :post] match 'auth/failure', to: redirect('/'), via: [:get, :post] match 'signout', to: 'sessions#destroy', as: 'signout', via: [:delete] + + + #connect to iphone + match 'phone', to: 'phone' end From 954b841603c292f093eb97809a5ea0818b25b55d Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 19:40:06 -0500 Subject: [PATCH 02/20] added phones route and controller --- .ruby-version | 1 + app/assets/javascripts/phones.js.coffee | 3 +++ app/assets/stylesheets/phones.css.scss | 3 +++ app/controllers/phones_controller.rb | 8 ++++++++ app/helpers/phones_helper.rb | 2 ++ config/routes.rb | 2 +- spec/controllers/phones_controller_spec.rb | 5 +++++ spec/helpers/phones_helper_spec.rb | 15 +++++++++++++++ 8 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .ruby-version create mode 100644 app/assets/javascripts/phones.js.coffee create mode 100644 app/assets/stylesheets/phones.css.scss create mode 100644 app/controllers/phones_controller.rb create mode 100644 app/helpers/phones_helper.rb create mode 100644 spec/controllers/phones_controller_spec.rb create mode 100644 spec/helpers/phones_helper_spec.rb diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..28c0c5e --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.0.0-p451 diff --git a/app/assets/javascripts/phones.js.coffee b/app/assets/javascripts/phones.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/phones.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/phones.css.scss b/app/assets/stylesheets/phones.css.scss new file mode 100644 index 0000000..dfef027 --- /dev/null +++ b/app/assets/stylesheets/phones.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the phones controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb new file mode 100644 index 0000000..4242339 --- /dev/null +++ b/app/controllers/phones_controller.rb @@ -0,0 +1,8 @@ +class PhonesController < ApplicationController + + def recieve + puts "This is something" + + end + +end diff --git a/app/helpers/phones_helper.rb b/app/helpers/phones_helper.rb new file mode 100644 index 0000000..69ebd13 --- /dev/null +++ b/app/helpers/phones_helper.rb @@ -0,0 +1,2 @@ +module PhonesHelper +end diff --git a/config/routes.rb b/config/routes.rb index b902894..281ac07 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,5 +10,5 @@ #connect to iphone - match 'phone', to: 'phone' + match 'phone', to: 'phones#recieve', via: [:get] end diff --git a/spec/controllers/phones_controller_spec.rb b/spec/controllers/phones_controller_spec.rb new file mode 100644 index 0000000..28f8076 --- /dev/null +++ b/spec/controllers/phones_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe PhonesController do + +end diff --git a/spec/helpers/phones_helper_spec.rb b/spec/helpers/phones_helper_spec.rb new file mode 100644 index 0000000..d69c7c8 --- /dev/null +++ b/spec/helpers/phones_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the PhonesHelper. For example: +# +# describe PhonesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe PhonesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end From 7c610d30c3a9f233eb888a2456b004a2c20372ea Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 19:46:13 -0500 Subject: [PATCH 03/20] added a template for the phone#recieve action --- app/views/phones/recieve.html.erb | 1 + 1 file changed, 1 insertion(+) create mode 100644 app/views/phones/recieve.html.erb diff --git a/app/views/phones/recieve.html.erb b/app/views/phones/recieve.html.erb new file mode 100644 index 0000000..6d2819b --- /dev/null +++ b/app/views/phones/recieve.html.erb @@ -0,0 +1 @@ +

This is a template for the phone controller

\ No newline at end of file From 2eb56b73db0920bf2e88786a2415114ede1ef070 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 19:55:11 -0500 Subject: [PATCH 04/20] Added a new header to the index page --- app/views/pingas/index.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/pingas/index.html.erb b/app/views/pingas/index.html.erb index 5695c6e..e45d8b2 100644 --- a/app/views/pingas/index.html.erb +++ b/app/views/pingas/index.html.erb @@ -1,5 +1,6 @@
+

THIS IS SOMETHING NEW

<%= render partial: "shared/map" %>
From 898ca49efae46a4ff0848692a957b27697a0fc04 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 20:23:42 -0500 Subject: [PATCH 05/20] added rack-cors gem and module information in config folder --- Gemfile | 2 ++ Gemfile.lock | 2 ++ app/controllers/phones_controller.rb | 2 +- config/application.rb | 6 ++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6f2ea2f..7210ec9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source 'https://rubygems.org' +gem 'rack-cors', :require => 'rack/cors' + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 9591496..b91ca5d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,6 +106,7 @@ GEM method_source (~> 0.8) slop (~> 3.4) rack (1.5.2) + rack-cors (0.2.9) rack-test (0.6.2) rack (>= 1.0) rails (4.0.0) @@ -201,6 +202,7 @@ DEPENDENCIES omniauth-facebook (= 1.4.0) pg pry + rack-cors rails (= 4.0.0) rails_12factor rspec-rails (~> 2.14.2) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 4242339..13b4d29 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -1,7 +1,7 @@ class PhonesController < ApplicationController def recieve - puts "This is something" + puts "THIS IS SOMETHING IN THE PHONESCONTROLLER **************************************************************" end diff --git a/config/application.rb b/config/application.rb index 61c49fc..12281fa 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,5 +26,11 @@ class Application < Rails::Application # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + config.middleware.use Rack::Cors do + allow do + origins '*' + resource '*', :headers => :any, :methods => [:get, :post, :options] + end + end end end From 73d1770ec08e0248b9e499c8fc74ff82a712615f Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 20:55:13 -0500 Subject: [PATCH 06/20] accessing params coming in from phone --- app/controllers/phones_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 13b4d29..b5a1a62 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -2,6 +2,7 @@ class PhonesController < ApplicationController def recieve puts "THIS IS SOMETHING IN THE PHONESCONTROLLER **************************************************************" + p params[:data] end From 30f4f8389eca4416445ceeac7cdc230bf7db1108 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 21:04:40 -0500 Subject: [PATCH 07/20] not printing out params --- app/controllers/phones_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index b5a1a62..65a494a 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -2,7 +2,7 @@ class PhonesController < ApplicationController def recieve puts "THIS IS SOMETHING IN THE PHONESCONTROLLER **************************************************************" - p params[:data] + # p params[:data] end From 7431b7a7202e91ca97ee4766486a5bfb8a9f60bc Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 21:21:35 -0500 Subject: [PATCH 08/20] trying to get the p staement to print out in ther heroku logs --- app/controllers/phones_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 65a494a..b512f68 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -1,7 +1,7 @@ class PhonesController < ApplicationController def recieve - puts "THIS IS SOMETHING IN THE PHONESCONTROLLER **************************************************************" + p "THIS IS SOMETHING IN THE PHONESCONTROLLER ********************" # p params[:data] end From abe25a8dd2863c1282eab193b43c7aab9b625795 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 21:27:06 -0500 Subject: [PATCH 09/20] trying to print out params again --- app/controllers/phones_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index b512f68..6456a9a 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -2,7 +2,7 @@ class PhonesController < ApplicationController def recieve p "THIS IS SOMETHING IN THE PHONESCONTROLLER ********************" - # p params[:data] + p params[:data] end From 1bd9896c45fbbadd47360a772d4010e976cfaabe Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 21:54:51 -0500 Subject: [PATCH 10/20] Commented out the require login to see if now phone can properly access the action in the phone controller --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6a6def1..9483043 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ class ApplicationController < ActionController::Base - before_filter :require_login + # before_filter :require_login #this is filtered so that the phone can access the web app protect_from_forgery with: :exception private From eda19e1f77ec4b2247a105247e7341ab4f2cf1be Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Fri, 23 May 2014 22:11:26 -0500 Subject: [PATCH 11/20] successfully getting into recieve action in phone controller; able to print out params; need to get rest of data needed from phone; need to write methods in webapp to get pinga migration data using phone data; note that require_login has been commented out to allow phone to proper http get request to /phone --- app/controllers/phones_controller.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 6456a9a..8f2010b 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -4,6 +4,31 @@ def recieve p "THIS IS SOMETHING IN THE PHONESCONTROLLER ********************" p params[:data] + + #this is currently the format of the new_ping hash that we are getting from the phone + #---------------------------------------------------------------------------------------- + # {"title"=>"", "description"=>"", "category"=>"Social", "start_time"=>"6:00 PM", "end_time"=>"8:00 PM", "address"=>""} + + + + #this is currently the format of the new_ping properties that is defined in our migrations + #---------------------------------------------------------------------------------------- + + #CHECK t.string :title + #CHECK t.string :description + #NO (determine in web app --- method) t.string :status + #CHECK t.datetime :start_time + #CHECK t.datetime :end_time + #CHECK t.string :address + #NO (get from the phone using bubblewraps's location obj) t.float :latitude + #NO (get from the phone using bubblewraps's location obj) t.float :longitude + #NO (need to somehow get the user information from the phone) t.integer :creator_id #user_id + #CHECK t.timestamps (this will be created when it is entered in the database) + + + + + end end From f54b5ee2dc6f095836c7d1742336fffc3bc01959 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 10:33:05 -0500 Subject: [PATCH 12/20] added get_events action to phones controller; refactored route names and actions --- app/controllers/phones_controller.rb | 21 +++++++++++++++---- app/views/phones/recieve.html.erb | 1 - .../recieve_request_create_event.html.erb | 1 + .../recieve_request_get_events.html.erb | 1 + config/routes.rb | 3 ++- 5 files changed, 21 insertions(+), 6 deletions(-) delete mode 100644 app/views/phones/recieve.html.erb create mode 100644 app/views/phones/recieve_request_create_event.html.erb create mode 100644 app/views/phones/recieve_request_get_events.html.erb diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 8f2010b..75e2be8 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -1,10 +1,22 @@ class PhonesController < ApplicationController - def recieve - p "THIS IS SOMETHING IN THE PHONESCONTROLLER ********************" + def recieve_request_get_events + p "THIS IS INSIDE GET EVENTS ACTION ********************" + p params #not sure there is even going to be params + + end + + + def recieve_request_create_event + p "THIS IS INSIDE CREATE EVENT ACTION ********************" p params[:data] + + + #TO DO + #--------------------------------------------------------------------------- + #this is currently the format of the new_ping hash that we are getting from the phone #---------------------------------------------------------------------------------------- # {"title"=>"", "description"=>"", "category"=>"Social", "start_time"=>"6:00 PM", "end_time"=>"8:00 PM", "address"=>""} @@ -27,8 +39,9 @@ def recieve - - + #QUESTIONS + #--------------------------------------------------------------------------------- + #How do we want to sanitize data? (trailing space?, newline? ) end end diff --git a/app/views/phones/recieve.html.erb b/app/views/phones/recieve.html.erb deleted file mode 100644 index 6d2819b..0000000 --- a/app/views/phones/recieve.html.erb +++ /dev/null @@ -1 +0,0 @@ -

This is a template for the phone controller

\ No newline at end of file diff --git a/app/views/phones/recieve_request_create_event.html.erb b/app/views/phones/recieve_request_create_event.html.erb new file mode 100644 index 0000000..5de362a --- /dev/null +++ b/app/views/phones/recieve_request_create_event.html.erb @@ -0,0 +1 @@ +

This is to confirm that the recieve_request_create_event action has been called within the phone controller

\ No newline at end of file diff --git a/app/views/phones/recieve_request_get_events.html.erb b/app/views/phones/recieve_request_get_events.html.erb new file mode 100644 index 0000000..2153203 --- /dev/null +++ b/app/views/phones/recieve_request_get_events.html.erb @@ -0,0 +1 @@ +

This is to confirm that the recieve_request_get_events action has been called within the phone controller

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 281ac07..cc3a789 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,5 +10,6 @@ #connect to iphone - match 'phone', to: 'phones#recieve', via: [:get] + match 'phone/get_events', to: 'phones#recieve_request_get_events', via: [:get] + match 'phone/create_event', to: 'phones#recieve_request_create_event', via: [:get] end From 878664f9eaf78adf90e0558bb50b55aee4364c5b Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 10:49:18 -0500 Subject: [PATCH 13/20] created action that is sending all pingas in database to phone --- app/controllers/phones_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 75e2be8..e9aa5f3 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -3,7 +3,8 @@ class PhonesController < ApplicationController def recieve_request_get_events p "THIS IS INSIDE GET EVENTS ACTION ********************" p params #not sure there is even going to be params - + all_pingas = Pinga.all + render json: all_pingas end From 8234a6fdb188833a7a640d5f64ea9c195876d070 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 11:39:54 -0500 Subject: [PATCH 14/20] Modified get_events action in phones controller --- app/controllers/phones_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index e9aa5f3..11f5bdf 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -4,7 +4,8 @@ def recieve_request_get_events p "THIS IS INSIDE GET EVENTS ACTION ********************" p params #not sure there is even going to be params all_pingas = Pinga.all - render json: all_pingas + p all_pingas + return all_pingas end From 850d0029f3356fe24a67ef817db0d1be0a550287 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 11:43:40 -0500 Subject: [PATCH 15/20] tryiing to_json --- app/controllers/phones_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 11f5bdf..4e0977a 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -4,8 +4,8 @@ def recieve_request_get_events p "THIS IS INSIDE GET EVENTS ACTION ********************" p params #not sure there is even going to be params all_pingas = Pinga.all - p all_pingas - return all_pingas + p all_pingas[0] + return all_pingas.to_json end From 0cf7f17826e0da26c7ee6851fb4b13a605224c13 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 14:27:25 -0500 Subject: [PATCH 16/20] added a skip filter on the phone controller --- app/controllers/application_controller.rb | 2 +- app/controllers/phones_controller.rb | 7 +++++-- app/controllers/sessions_controller.rb | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9483043..e397db6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ class ApplicationController < ActionController::Base - # before_filter :require_login #this is filtered so that the phone can access the web app + before_filter :require_login protect_from_forgery with: :exception private diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 4e0977a..23d173d 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -1,10 +1,11 @@ class PhonesController < ApplicationController +skip_before_filter :require_login, :only => [:recieve_request_get_events, :recieve_request_create_event] #add the phone controller pages in here def recieve_request_get_events p "THIS IS INSIDE GET EVENTS ACTION ********************" p params #not sure there is even going to be params all_pingas = Pinga.all - p all_pingas[0] + p all_pingas return all_pingas.to_json end @@ -13,6 +14,8 @@ def recieve_request_create_event p "THIS IS INSIDE CREATE EVENT ACTION ********************" p params[:data] + #geocode it with geocode gem (look for a method that can allow me to convert the address to the to the lat long) + @@ -34,7 +37,7 @@ def recieve_request_create_event #CHECK t.datetime :start_time #CHECK t.datetime :end_time #CHECK t.string :address - #NO (get from the phone using bubblewraps's location obj) t.float :latitude + #NO (get from the the address) t.float :latitude #NO (get from the phone using bubblewraps's location obj) t.float :longitude #NO (need to somehow get the user information from the phone) t.integer :creator_id #user_id #CHECK t.timestamps (this will be created when it is entered in the database) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 1cbdd8b..b04ebc5 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,5 +1,5 @@ class SessionsController < ActionController::Base - skip_before_filter :require_login, :only => [:new, :create] + skip_before_filter :require_login, :only => [:new, :create] #add the phone controller pages in here def new end From e3b83bc8dac9391417d93d10fcf81a8afa3b90e4 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 14:37:57 -0500 Subject: [PATCH 17/20] trying to return the data that i am sending back to the phone --- app/controllers/phones_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 23d173d..fce60b7 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -12,10 +12,14 @@ def recieve_request_get_events def recieve_request_create_event p "THIS IS INSIDE CREATE EVENT ACTION ********************" - p params[:data] #geocode it with geocode gem (look for a method that can allow me to convert the address to the to the lat long) + create_event_data = params[:data] + + p create_event_data + + return create_event_data.to_json From 9c5779e52f29ed75db2ca2cf2925e6473d740206 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 14:50:39 -0500 Subject: [PATCH 18/20] using respond_with to send back data to phone --- app/controllers/phones_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index fce60b7..a3f815c 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -15,11 +15,11 @@ def recieve_request_create_event #geocode it with geocode gem (look for a method that can allow me to convert the address to the to the lat long) - create_event_data = params[:data] + @create_event_data = params[:data] - p create_event_data + p @create_event_data - return create_event_data.to_json + respond_with @create_event_data From 32bb2c7d3787130074d79222215830267fd2f1b2 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 14:56:08 -0500 Subject: [PATCH 19/20] Gave the respond_to a value of json in the controller class --- app/controllers/phones_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index a3f815c..3f1446d 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -1,6 +1,8 @@ class PhonesController < ApplicationController skip_before_filter :require_login, :only => [:recieve_request_get_events, :recieve_request_create_event] #add the phone controller pages in here + respond_to :json + def recieve_request_get_events p "THIS IS INSIDE GET EVENTS ACTION ********************" p params #not sure there is even going to be params From 6816a48f742418588b8f9b1c017e63cba16c2aa4 Mon Sep 17 00:00:00 2001 From: Rohan Mathur Date: Sat, 24 May 2014 15:48:21 -0500 Subject: [PATCH 20/20] added @all_pingas --- app/controllers/phones_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 3f1446d..2cd3c93 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -5,10 +5,10 @@ class PhonesController < ApplicationController def recieve_request_get_events p "THIS IS INSIDE GET EVENTS ACTION ********************" - p params #not sure there is even going to be params - all_pingas = Pinga.all - p all_pingas - return all_pingas.to_json + # p params #not sure there is even going to be params + @all_pingas = Pinga.all + p @all_pingas + respond_with @all_pingas end