当有人尝试使用旧/:idURL而不是首选/:friendly_id链接浏览页面时,是否可以强制执行301重定向?
显然这样的重定向有助于告诉谷歌你已经更新了链接 ..所以它停止显示旧的非友好链接.
所以前几天我遇到了极端的硬盘问题,不得不手动删除我的.gem文件夹.我试图通过进入我的项目文件夹来重建我的应用程序的宝石bundle install...我很遗憾地遇到了这个错误:
/home/xxx/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/xxx/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'
Run Code Online (Sandbox Code Playgroud)
顺便说一下,kernel_require.rb的第54行是return gem_original_require(path):
if Gem::Specification.unresolved_deps.empty? then
RUBYGEMS_ACTIVATION_MONITOR.exit
return gem_original_require(path)
end
Run Code Online (Sandbox Code Playgroud) 以下是我的看法:
<%= javascript_include_tag "social_sharing.erb" %>
Run Code Online (Sandbox Code Playgroud)
然后我有:assets/javascripts/social_sharing.erb.js其中包括一些ERB标签,如<%= post.id %>......
第一个问题是我看到此错误消息:
`Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( social_sharing.erb.js )` to `config/initializers/assets.rb` and restart your server
Run Code Online (Sandbox Code Playgroud)
如果我遵循这些指示,然后我将获得js文件,但没有评估任何ERB标记,所以我仍然<%= post.id %>在链接的js文件中看到.
我是"项目"回购的所有者,但不知怎的,我无法推动它.
user@none ~/rails_projects/project $ git remote -v
origin git@github.com:user/project.git (fetch)
origin git@github.com:user/project.git (push)
Run Code Online (Sandbox Code Playgroud)
这是验证检查:
user@none ~/rails_projects/project $ ssh -T git@github.com
Hi user/project! You've successfully authenticated, but GitHub does not provide shell access.
Run Code Online (Sandbox Code Playgroud)
推送尝试:
user@none ~/rails_projects/project $ git push origin qa
ERROR: The key you are authenticating with has been marked as read only.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
知道如何修复此错误吗?
我在/app/asssets/images/symbols.svg上有一个svg图像,内容如下.
<svg xmlns="http://www.w3.org/2000/svg"><symbol id="icon-search" viewBox="0 0 18 18"><path fill="currentColor" d="M12.8 11.4c.9-1.2 1.4-2.7 1.4-4.3C14.2 3.2 11 0 7.1 0S0 3.2 0 7.1c0 3.9 3.2 7.1 7.1 7.1 1.6 0 3.1-.5 4.3-1.4l5.2 5.2 1.4-1.4-5.2-5.2zM2 7.1C2 4.3 4.3 2 7.1 2s5.1 2.3 5.1 5.1-2.3 5.1-5.1 5.1S2 9.9 2 7.1z"/></symbol><symbol id="icon-view-default" viewBox="0 0 18 18"><g fill="currentColor"><path d="M8 11H0V0h8v11zM18 5h-8V0h8v5zM8 18H0v-5h8v5zM18 18h-8V7h8v11z"/></g></symbol><symbol id="icon-view-alt" viewBox="0 0 18 18"><g fill="currentColor"><path d="M8 8H0V0h8v8zM18 8h-8V0h8v8zM8 18H0v-8h8v8zM18 18h-8v-8h8v8z"/></g></symbol><symbol id="icon-view-full" viewBox="0 0 18 18"><g fill="currentColor"><path d="M18 8H0V0h18v8zM18 18H0v-8h18v8z"/></g></symbol><symbol id="icon-facebook" viewBox="0 0 …Run Code Online (Sandbox Code Playgroud) 在我的主页面容器中生成的内容与此DIV的内容重叠:
<div class="navbar navbar-fixed-bottom"></div>
Run Code Online (Sandbox Code Playgroud)
这是来自github项目的CSS(bootstrap sass)
// Fix the top/bottom navbars when screen real estate supports it
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
border-width: 0 0 1px;
// Undo the rounded corners
@media (min-width: $grid-float-breakpoint) {
border-radius: 0;
}
}
.navbar-fixed-top {
z-index: $zindex-navbar-fixed;
top: 0;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0; // override .navbar defaults
}
Run Code Online (Sandbox Code Playgroud)
我相信这是由于在加载页面后JS呈现内容呈现而发生的.
有没有办法解决这个问题,而不知道JS内容的垂直高度提前?
编辑
这是导航栏上方的容器DIV的CSS:
-webkit-animation-delay: 0s;
-webkit-animation-direction: normal;
-webkit-animation-duration: 0s;
-webkit-animation-fill-mode: none;
-webkit-animation-iteration-count: 1;
-webkit-animation-name: none;
-webkit-animation-play-state: running;
-webkit-animation-timing-function: …Run Code Online (Sandbox Code Playgroud) 这是我想要做的:
2.1.2 :001 > UpdateStyleRanks.perform_async
Run Code Online (Sandbox Code Playgroud)
这是错误:
NoMethodError: undefined method `perform' for #<UpdateStyleRanks:0x00000002f5e388>
Run Code Online (Sandbox Code Playgroud)
这是我的工人:
# app/workers/update_style_ranks.rb
class UpdateStyleRanks
include Sidekiq::Worker
def perform
end
end
Run Code Online (Sandbox Code Playgroud) 我一直在研究这个小提琴,我想要一些建议.
如您所见,我无法在正确的位置渲染多个标记.无论我做什么,两个标记都根据htmlMarker[i]阵列中第二个标记的位置进行渲染.
谢谢你的帮助!
供参考,这是JS:
var overlay;
function initialize() {
var myLatLng = new google.maps.LatLng(62.323907, -150.109291);
var mapOptions = {
zoom: 11,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var gmap = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
function HTMLMarker(lat,lng){
this.lat = lat;
this.lng = lng;
this.pos = new google.maps.LatLng(lat,lng);
}
HTMLMarker.prototype = new google.maps.OverlayView();
HTMLMarker.prototype.onRemove= function(){}
//init your html element here
HTMLMarker.prototype.onAdd= function(){
div = document.createElement('DIV');
div.className = "htmlMarker";
div.innerHTML = '<img src="http://www.vcsd.org/img/icon/red.png">';
var panes = this.getPanes();
panes.overlayImage.appendChild(div);
}
HTMLMarker.prototype.draw = …Run Code Online (Sandbox Code Playgroud) 我最近遇到过一个问题,我必须在gemfile中添加以下内容:
gem 'execjs'
gem 'therubyracer'
Run Code Online (Sandbox Code Playgroud)
我必须这样做,以避免启动rails服务器时出现javascript运行时错误.我想将这个修改添加到使用rails new命令创建的所有新gemfiles中.
git add .在提交更改之前,我已经打字多年了.根据我的理解(从下面的信息中),现代的等价物将git add --ignore-removal <pathspec>更加冗长.有没有办法在即将发布的git 2.0版本中恢复旧的行为,或者至少在当前版本中将此消息静音?
$ git add .
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal',
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'log/sunspot-solr-development.log.lck' that are
removed from your working tree are ignored with this version of Git.
* 'git add --ignore-removal <pathspec>', which is the current default,
ignores paths you removed from your working tree.
* 'git add --all …Run Code Online (Sandbox Code Playgroud) javascript ×3
git ×2
ruby ×2
css ×1
github ×1
google-maps ×1
redis ×1
rvm ×1
sidekiq ×1
svg ×1