Permalink
Browse files

fIxing column list reference.

  • Loading branch information...
1 parent b25ef8d commit 9b6a836fbcc9c4bcef2c92cbb9567d9650994bfe Elad Meidar committed Nov 12, 2009
@@ -7,7 +7,7 @@ class ViewDefinition
def initialize(base)
@columns = []
@base = base
- @select_query = select_query
+ @select_query = ''
end
def column(name)
@@ -21,7 +21,9 @@ def select(select_query)
end
def to_sql
- @columns.collect { |c| @base.quote_column_name(c) } * ', '
+ if @columns.any?
+ @columns.collect { |c| @base.quote_column_name(c) } * ', '
+ end
end
end
@@ -12,7 +12,7 @@ def self.included(base)
# values: CASCADED and LOCAL. See your database documentation for allowed values.
def create_view(name, options={})
if supports_views?
- view_definition = ViewDefinition.new(self, select_query)
+ view_definition = ViewDefinition.new(self)
yield view_definition

0 comments on commit 9b6a836

Please sign in to comment.