diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-09-13 20:03:30 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-09-13 21:02:43 +0900 |
commit | dcd39949f8801cb4beddec37143a585259f09a2d (patch) | |
tree | d27bca5fe39f2c587fa3919b6781e8c30bc3b144 /activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | |
parent | 602ec7a4a21846db74f0371eb27784f19f80e28c (diff) | |
download | rails-dcd39949f8801cb4beddec37143a585259f09a2d.tar.gz rails-dcd39949f8801cb4beddec37143a585259f09a2d.tar.bz2 rails-dcd39949f8801cb4beddec37143a585259f09a2d.zip |
Add `#views` and `#view_exists?` methods on connection adapters
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 08803303cf..43512c6bcc 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -36,6 +36,19 @@ module ActiveRecord tables.include?(table_name.to_s) end + # Returns an array of view names defined in the database. + def views + raise NotImplementedError, "#views is not implemented" + end + + # Checks to see if the view +view_name+ exists on the database. + # + # view_exists?(:ebooks) + # + def view_exists?(view_name) + views.include?(view_name.to_s) + end + # Returns an array of indexes for the given table. # def indexes(table_name, name = nil) end |