我想在临时目录中创建临时文件。下面是我的代码。
require 'tmpdir'
require 'tempfile'
Dir.mktmpdir do |dir|
Dir.chdir(dir)
TemFile.new("f")
sleep 20
end
Run Code Online (Sandbox Code Playgroud)
它给了我这个例外:
Errno::EACCES: Permission denied - C:/Users/SANJAY~1/AppData/Local/Temp/d20130724-5600-ka2ame,因为 ruby 正在尝试删除一个非空的临时目录。
请帮我在临时目录中创建一个临时文件。
我想用机架中间件打印模板的主体.下面是我的设置......
#config/initializers/response_timer.rb
class ResponseTimer
def initialize(app)
@app = app
end
def call(env)
status, headers, response = @app.call(env)
[status, headers, response.body]
end
end
#application.rb file
config.middleware.use "ResponseTimer"
Run Code Online (Sandbox Code Playgroud)
当我提出请求domainname/students /我收到以下错误.
undefined method `each' for #<String:0xd69a2e0>
Run Code Online (Sandbox Code Playgroud)
请帮助.
我想将url显示为"www.test.com/!#",因为我正在使用$ locationProvider.hashPrefix("!"); 但它显示网址为"www.test.com/#!" .我想要 "!" 哈希之前不哈希.
谢谢
var app = angular.module('app', []);
app.config(function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix("!");
$routeProvider.when('/', {
templateUrl: "app.html",
controller: "AppCtrl"
}
)
.when('/Program', {
templateUrl: "detail1.html",
controller: "Redirect"
})
.when('/Program/123456/channel/78458585',
{
templateUrl: "details.html",
controller: "Detail"
});
});
app.controller("AppCtrl", function ($scope) {
});
app.controller("Detail", function ($scope, $location) {
});
app.controller("Redirect", function ($scope, $location) {
$location.path("/Program/123456/channel/78458585")
});
Run Code Online (Sandbox Code Playgroud)