From 30b902760906be4e8e4655806874fdf5316fba57 Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Tue, 15 Feb 2011 18:15:41 +0100 Subject: [PATCH 1/2] Coding --- app/controllers/api/json/tables_controller.rb | 2 ++ spec/acceptance/tables_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/api/json/tables_controller.rb b/app/controllers/api/json/tables_controller.rb index 7e05b90735..8a6649b7c1 100644 --- a/app/controllers/api/json/tables_controller.rb +++ b/app/controllers/api/json/tables_controller.rb @@ -1,3 +1,5 @@ +# coding: UTF-8 + class Api::Json::TablesController < ApplicationController skip_before_filter :verify_authenticity_token diff --git a/spec/acceptance/tables_spec.rb b/spec/acceptance/tables_spec.rb index 2ed4369ca3..f550f828c0 100644 --- a/spec/acceptance/tables_spec.rb +++ b/spec/acceptance/tables_spec.rb @@ -1,3 +1,5 @@ +# coding: UTF-8 + require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper') feature "Tables" do From be4f2e19d0512425950d22df62bf537de61d48f2 Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Tue, 15 Feb 2011 18:23:02 +0100 Subject: [PATCH 2/2] Setting new geometry columns --- app/controllers/api/json/tables_controller.rb | 2 +- db/seeds.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/json/tables_controller.rb b/app/controllers/api/json/tables_controller.rb index 8a6649b7c1..9b63519662 100644 --- a/app/controllers/api/json/tables_controller.rb +++ b/app/controllers/api/json/tables_controller.rb @@ -333,7 +333,7 @@ class Api::Json::TablesController < ApplicationController protected def load_table - @table = Table.select(:id,:user_id,:name,:privacy).filter(:id => params[:id]).first + @table = Table.select(:id,:user_id,:name,:privacy,:geometry_columns).filter(:id => params[:id]).first raise RecordNotFound if @table.user_id != current_user.id end diff --git a/db/seeds.rb b/db/seeds.rb index e00d896431..ae330d4dfe 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -43,6 +43,7 @@ table = Table.new :privacy => Table::PRIVATE, :name => 'Downloaded movies', table.user_id = user.id table.force_schema = "name varchar(255), address varchar(255), latitude float, longitude float" table.save +table.set_lan_lon_columns!(:latitude, :longitude) user.run_query("INSERT INTO #{table.name} (name, address, latitude, longitude) values ('#{String.random(15)}','Calle Santa Ana 1, 3C, Madrid',#{rand(100000).to_f / 100.0},#{rand(100000).to_f / 100.0})" ) user.run_query("INSERT INTO #{table.name} (name, address, latitude, longitude) values ('#{String.random(15)}','Calle Hortaleza 48, Madrid',#{rand(100000).to_f / 100.0},#{rand(100000).to_f / 100.0})" )