Skip to content

Commit

Permalink
Fixed bug where a plugins tab initialization was raising a Mysql::Err…
Browse files Browse the repository at this point in the history
…or during crm:setup, as the 'settings' table had not been created yet.
  • Loading branch information
ndbroadbent committed Aug 13, 2010
1 parent 3722029 commit ef6a866
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/fat_free_crm/plugin.rb
@@ -1,16 +1,16 @@
# Fat Free CRM
# Copyright (C) 2008-2010 by Michael Dvorkin
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -53,12 +53,14 @@ def tab(main_or_admin, options = nil)
options = main_or_admin.dup # ...and use :main as default.
main_or_admin = :main
end
tabs = FatFreeCRM::Tabs.send(main_or_admin)
if tabs # Might be nil when running rake task (ex: rake crm:setup).
if block_given?
yield tabs
else
tabs << options if options
if ActiveRecord::Base.connection.table_exists?("settings")
tabs = FatFreeCRM::Tabs.send(main_or_admin)
if tabs # Might be nil when running rake task (ex: rake crm:setup).
if block_given?
yield tabs
else
tabs << options if options
end
end
end
end
Expand Down Expand Up @@ -87,4 +89,5 @@ def list
end

end # class Plugin
end # module FatFreeCRM
end # module FatFreeCRM

0 comments on commit ef6a866

Please sign in to comment.