aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/nodes/select_core.rb2
-rw-r--r--lib/arel/select_manager.rb6
-rw-r--r--spec/arel/select_manager_spec.rb2
3 files changed, 3 insertions, 7 deletions
diff --git a/lib/arel/nodes/select_core.rb b/lib/arel/nodes/select_core.rb
index e52db6eb77..bd85dad24a 100644
--- a/lib/arel/nodes/select_core.rb
+++ b/lib/arel/nodes/select_core.rb
@@ -1,7 +1,7 @@
module Arel
module Nodes
class SelectCore
- attr_reader :froms, :projections, :wheres, :groups
+ attr_accessor :froms, :projections, :wheres, :groups
attr_accessor :having
def initialize
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index 7512dd90ed..df3f21c3b6 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -51,11 +51,7 @@ module Arel
end
def from table
- if String === table
- return self if @ctx.froms.any? { |x| x.name.to_s == table }
- end
-
- @ctx.froms << table
+ @ctx.froms = [table]
self
end
diff --git a/spec/arel/select_manager_spec.rb b/spec/arel/select_manager_spec.rb
index fa1bbdddce..4262a7465b 100644
--- a/spec/arel/select_manager_spec.rb
+++ b/spec/arel/select_manager_spec.rb
@@ -60,7 +60,7 @@ module Arel
manager.from table
manager.from 'users'
manager.project table['id']
- manager.to_sql.should be_like 'SELECT "users"."id" FROM "users"'
+ manager.to_sql.should be_like 'SELECT "users"."id" FROM \'users\''
end
end