我最终有效地复制了9次迁移.(我认为这是因为我安装/更新了Gems和/或在我的开发和生产机器上进行了迁移,但现阶段并不完全确定.)
我从生产服务器上的rails目录中移出了一组重复的9,但是现在我想要进行db:migrate生产以便运行另一个迁移,我得到:
$ bundle exec rake db:migrate RAILS_ENV=production
[DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.attributes.checkout" is no longer supported
== CreatePages: migrating ====================================================
-- create_table(:pages)
rake aborted!
An error has occurred, all later migrations canceled:
Mysql2::Error: Table 'pages' already exists: CREATE TABLE `pages` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(255), `body` text, `slug` varchar(255), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB
Run Code Online (Sandbox Code Playgroud)
这是因为迁移已经有效地运行了.
我宁愿避免这样做db:migrate:down,并db:migrate:up为每一个-我认为这将意味着在生产数据库中的数据丢失.(在这种情况下,Spree中有几个静态页面.)
有没有办法可以告诉Rails的这个安装忘记所有未完成的迁移,有效地标记所有未完成的迁移?
我正在创建一个简单的(好吧,在我决定用Microdata标记它之前很简单)网页,其中包含有两个办公室的公司的公司联系信息.我正在两个办公室使用schema.org和LocalBusiness.
以下是我的HTML的相关部分:
<body itemscope itemtype="http://schema.org/Corporation">
<header>
<hgroup>
<h1>Company Name</h1>
<h2 itemprop="description">Company description</h2>
</hgroup>
</header>
<section>
<h1><span itemprop="name">Company Name Limited</span> Offices</h1>
<article itemscope itemtype="http://schema.org/LocalBusiness">
<h2 itemprop="name">Company Name, Location 1 Office</h2>
<p itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Street Address</span><br />
<span itemprop="addressLocality">Locality</span><br />
<span itemprop="addressRegion">Region</span><br />
<span itemprop="postalCode">Postcode</span><br />
<span itemprop="addressCountry">Country</span>
</p>
<p><a itemprop="maps" href="http://maps.google.co.uk/blahblah">Map</a></p>
<p>Telephone: <span itemprop="telephone">01234 567890</span><br />
Fax: <span itemprop="faxNumber">01234 567890</span><br />
Email: <span itemprop="email">email@domain.co.uk</span><br />
<a href="http://www.domain.co.uk" itemprop="url">http://www.domain.co.uk</a></p>
<!-- itemprop="branchOf" -->
</article>
<article itemscope itemtype="http://schema.org/LocalBusiness">
<h2 itemprop="name">Company …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用 NixOS,到目前为止已成功/etc/nixos/configuration.nix在我的 NixOS 18.09 VM 中进行编辑以启用 PHP-FPM 和 Caddy Web 服务器。
{ config, pkgs, ... }:
{
imports = [ <nixpkgs/nixos/modules/installer/virtualbox-demo.nix> ];
users = {
mutableUsers = false;
groups = {
caddy = { };
php-project = { };
};
users = {
hello = {
group = "php-project";
};
};
};
environment.systemPackages = [
pkgs.htop
pkgs.httpie
pkgs.php # for PHP CLI
];
services.caddy = {
enable = true;
email = "david@example.com";
agree = true;
config = '' …Run Code Online (Sandbox Code Playgroud) 在这个字符串中:
"<0> << 1 >> <2 >> <3> <4>"
我希望匹配"<\ d {1,2}>"的所有实例,除了那些我用一组额外的三角括号进行转义的实例,例如,我想匹配0,2,3,4而不是1,例如:
" <0> << 1 >> <2 >> <3> <4> "
我想在一个正则表达式中执行此操作,但我能得到的最好的是:
(^ | [^\<])\ <>([^(<1>\d {1,2}?)>] | $)
哪个匹配0,3,4而不是2,例如:
" <0> << 1 >> <2 >> <3> <4> "
有谁知道如何使用单个正则表达式完成此操作?
我无法在我的本地Ubuntu测试LAMP服务器上覆盖子类中的函数,但是当上载到Web服务器时,相同的代码导致所需的覆盖.
原班级:
class HandsetDetection {
function HandsetDetection() {
//code I wish to replace
}
}
Run Code Online (Sandbox Code Playgroud)
我的课:
class HandsetDetection_RespondHD extends HandsetDetection {
function HandsetDetection() {
//code I wish to use
}
}
Run Code Online (Sandbox Code Playgroud)
构造函数不参与.
在我的本地机器上使用的PHP版本是PHP 5.3.3-1ubuntu9.5与Suhosin-Patch(cli)(内置:2011年5月3日00:48:48)
覆盖成功的Web服务器上的PHP版本是5.2.17
你能想到为什么会这样吗?
我发现我无法使用花括号和冒号语法或括号和字符串语法将Stylus哈希值设置为使用逗号.用值包装值"或'将导致这些字符作为值的一部分输出.
目前,我有:
fonts-serif = Georgia, serif
fonts-sans-serif = Helvetica, Arial, sans-serif
fonts = {
serif: fonts-serif,
sans-serif: fonts-sans-serif
}
Run Code Online (Sandbox Code Playgroud)
使用这些值:
font-family: fonts.serif
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?
这很好用
{% include 'site/snippet.html.twig'
with {'description': 'Some text'}
%}
Run Code Online (Sandbox Code Playgroud)
但是如何使这个工作?使用翻译作为参数
{% include 'site/snippet.html.twig'
with {'description': '{{ 'solutions.description' | trans }}'}
%}
Run Code Online (Sandbox Code Playgroud)
snippet.html内容为:
<p>
{{ description }}
</p>
Run Code Online (Sandbox Code Playgroud)
并且{{ 'solutions.description' | trans }}单独调用翻译会按预期显示内容.
它会是什么语法?