From f4c03a4a80acb857191f02cd510cc1bfa899f1e7 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Sat, 26 Oct 2013 16:18:43 -0500 Subject: [PATCH] fixes on assets --- lib/Rails/ActiveRecord/ModelSchema.php | 4 ++-- lib/Rails/Panel/controllers/AdminController.php | 6 ++++++ lib/Rails/Rails.php | 13 +++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/Rails/ActiveRecord/ModelSchema.php b/lib/Rails/ActiveRecord/ModelSchema.php index 7d322e9..4dfa180 100755 --- a/lib/Rails/ActiveRecord/ModelSchema.php +++ b/lib/Rails/ActiveRecord/ModelSchema.php @@ -38,7 +38,7 @@ class ModelSchema public function schemaFile() { - $path = Rails::root() . '/db/table_schema/' . $this->connection_name(); + $path = Rails::root() . '/db/table_schema/' . $this->connection->name(); $file = $path . '/' . $this->name . '.php'; return $file; } @@ -51,7 +51,7 @@ class ModelSchema $this->loadCachedSchema(); } elseif (!$this->getSchema()) { throw new Exception\RuntimeException( - sprintf("Couldn't find schema for %s: %s", $this->name, $this->error_stmt) + sprintf("Couldn't find schema for %s", $this->name) ); } } diff --git a/lib/Rails/Panel/controllers/AdminController.php b/lib/Rails/Panel/controllers/AdminController.php index b4e5032..e01f5f3 100755 --- a/lib/Rails/Panel/controllers/AdminController.php +++ b/lib/Rails/Panel/controllers/AdminController.php @@ -93,6 +93,12 @@ class AdminController extends ApplicationController Rails\Assets\Parser\Javascript\ClosureApi\ClosureApi::errorFile(), $e->getMessage()); $this->error = $message; + } catch (\Exception $e) { + /** + * If another error occurs, it won't be properly shown because of production config. + */ + Rails::resetConfig('development'); + throw $e; } Rails::resetConfig('development'); diff --git a/lib/Rails/Rails.php b/lib/Rails/Rails.php index f1879cc..e201f15 100755 --- a/lib/Rails/Rails.php +++ b/lib/Rails/Rails.php @@ -130,14 +130,11 @@ final class Rails $prefix = str_replace('\\', '/', self::$config->assets->prefix); - $router = self::application()->router(); - if (!$router || !$router->route() || !$router->route()->isPanelRoute()) { - $basePaths = [ - str_replace('\\', '/', Rails::config()->paths->application) . $prefix, - str_replace('\\', '/', Rails::root() . '/lib') . $prefix, - str_replace('\\', '/', Rails::root() . '/vendor') . $prefix, - ]; - } + $basePaths = [ + str_replace('\\', '/', Rails::config()->paths->application) . $prefix, + str_replace('\\', '/', Rails::root() . '/lib') . $prefix, + str_replace('\\', '/', Rails::root() . '/vendor') . $prefix, + ]; $paths = [];