我在我的博客上使用Octopress,需要创建一个下载文本文件的链接.
有一个名为include_code的内置插件可以呈现链接,但也会显示该文件.我只想要链接.有谁知道我怎么做到这一点?
我正在尝试使用rails检索用户名以插入到博客文章的评论中
如果我使用
<%= comment.user_id %>"
Run Code Online (Sandbox Code Playgroud)
它会给我一个id但如果我尝试检索用户然后调用它返回nil类的名称
<%= User.find_by_id(comment.user_id).name %>"
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用
如果我离开.name,它会在内存中返回一个空格.
#<User:000x00000182fe48>
Run Code Online (Sandbox Code Playgroud) 我正在尝试为Google地方自动填充实现自定义用户界面,因为预建的用户不允许我手动选择结果.在getPlacePredictions函数选项中不使用多个类型时,一切都有效,但当我使用['(regions)','(cities)']时,状态返回'invalid request'
我做错了什么还是不可能返回多种类型?
var _this = this;
this.input = $('#zipcode_autocomplete');
this.service = new google.maps.places.AutocompleteService();
this.input.on('input', function() {
return _this.service.getPlacePredictions({
input: _this.input.val(),
types: ['(regions)', '(cities)'],
componentRestrictions: {
country: 'us'
}
}, _this.callback);
});
this.callback = function(predictions, status) {
var i, prediction, _results;
console.log(predictions);
if (status !== google.maps.places.PlacesServiceStatus.OK) {
alert(status);
return;
}
i = 0;
prediction = void 0;
this.results = $('ul.location_results').removeClass('hidden').html('');
_results = [];
while (prediction = predictions[i]) {
this.results.append("<li><span class='location-address'>" + prediction.terms[0].value + "</span><span class='location-state'>" + prediction.terms[prediction.terms.length - 2].value + …Run Code Online (Sandbox Code Playgroud)