Skip to content

Commit

Permalink
fixes on assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Parziphal committed Oct 26, 2013
1 parent a70f9cb commit f4c03a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/Rails/ActiveRecord/ModelSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function setName($name)

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;
}
Expand All @@ -51,7 +51,7 @@ public function reloadSchema()
$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)
);
}
}
Expand Down
6 changes: 6 additions & 0 deletions lib/Rails/Panel/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ public function compileAssets()
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');
Expand Down
13 changes: 5 additions & 8 deletions lib/Rails/Rails.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,11 @@ static public function assets()

$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 = [];

Expand Down

0 comments on commit f4c03a4

Please sign in to comment.