From 17206a20e5bcb44fa4d90f0e176f7aa0fe43bca3 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 17 Jan 2013 21:51:58 +0100 Subject: rename_column table to routing_table --- app/controllers/call_routes_controller.rb | 4 ++-- app/models/call_route.rb | 4 ++-- app/views/call_routes/_form_core.html.haml | 2 +- app/views/call_routes/index.html.haml | 6 +++--- app/views/call_routes/show.html.haml | 2 +- misc/freeswitch/scripts/dialplan/router.lua | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index b0c173d..130a160 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -4,8 +4,8 @@ class CallRoutesController < ApplicationController before_filter :spread_breadcrumbs def index - @call_routes = CallRoute.order(['`table`', :position]) - @tables = @call_routes.pluck('`table`').uniq.sort + @call_routes = CallRoute.order([:routing_table, :position]) + @routing_tables = @call_routes.pluck(:routing_table).uniq.sort end def show diff --git a/app/models/call_route.rb b/app/models/call_route.rb index f6a3dd3..0df961d 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -1,7 +1,7 @@ class CallRoute < ActiveRecord::Base ROUTING_TABLES = ['prerouting', 'outbound', 'inbound'] - attr_accessible :table, :name, :endpoint_type, :endpoint_id, :position + attr_accessible :routing_table, :name, :endpoint_type, :endpoint_id, :position has_many :route_elements, :dependent => :destroy @@ -12,7 +12,7 @@ class CallRoute < ActiveRecord::Base :presence => true, :inclusion => { :in => ROUTING_TABLES } - acts_as_list :scope => '`table` = \'#{table}\'' + acts_as_list :scope => '`routing_table` = \'#{routing_table}\'' def to_s name.to_s diff --git a/app/views/call_routes/_form_core.html.haml b/app/views/call_routes/_form_core.html.haml index 4712e2f..2eee795 100644 --- a/app/views/call_routes/_form_core.html.haml +++ b/app/views/call_routes/_form_core.html.haml @@ -1,5 +1,5 @@ .inputs - = f.input :table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false + = f.input :routing_table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false = f.input :name, :label => t('call_routes.form.name.label'), :hint => conditional_hint('call_routes.form.name.hint') = f.input :endpoint_type, :label => t('call_routes.form.endpoint_type.label'), :hint => conditional_hint('call_routes.form.endpoint_type.hint') = f.input :endpoint_id, :label => t('call_routes.form.endpoint_id.label'), :hint => conditional_hint('call_routes.form.endpoint_id.hint') diff --git a/app/views/call_routes/index.html.haml b/app/views/call_routes/index.html.haml index c83606b..151fc0e 100644 --- a/app/views/call_routes/index.html.haml +++ b/app/views/call_routes/index.html.haml @@ -2,10 +2,10 @@ - if @call_routes && @call_routes.count > 0 %table - - @tables.each do |table| + - @routing_tables.each do |routing_table| %tr %td{:colspan => 3} - %h3= table - = render "index_core", :call_routes => @call_routes.where(:table => table) + %h3= routing_table + = render "index_core", :call_routes => @call_routes.where(:routing_table => routing_table) = render :partial => 'shared/create_link', :locals => {:child_class => CallRoute} diff --git a/app/views/call_routes/show.html.haml b/app/views/call_routes/show.html.haml index 8be64e6..bada227 100644 --- a/app/views/call_routes/show.html.haml +++ b/app/views/call_routes/show.html.haml @@ -2,7 +2,7 @@ %p %strong= t('call_routes.show.table') + ":" - = @call_route.table + = @call_route.routing_table %p %strong= t('call_routes.show.name') + ":" = @call_route.name diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index f207276..33434ee 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -28,7 +28,7 @@ function Router.read_table(self, table_name) local sql_query = 'SELECT * \ FROM `call_routes` `a` \ JOIN `route_elements` `b` ON `a`.`id` = `b`.`call_route_id`\ - WHERE `a`.`table` = "' .. table_name .. '" \ + WHERE `a`.`routing_table` = "' .. table_name .. '" \ ORDER BY `a`.`position`, `b`.`position`'; local last_id = 0; -- cgit v1.2.3