我在Ruby中有这个模型,但它抛出了一个 ActiveModel::ForbiddenAttributesError
class User < ActiveRecord::Base
attr_accessor :password
validates :username, :presence => true, :uniqueness => true, :length => {:in => 3..20}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, :uniqueness => true, format: { with: VALID_EMAIL_REGEX }
validates :password, :confirmation => true
validates_length_of :password, :in => 6..20, :on => :create
before_save :encrypt_password
after_save :clear_password
def encrypt_password
if password.present?
self.salt = BCrypt::Engine.generate_salt
self.encrypted_password= BCrypt::Engine.hash_secret(password, salt)
end
end
def clear_password
self.password = nil
end
end
Run Code Online (Sandbox Code Playgroud)
当我运行这个动作
def create
@user = User.new(params[:user])
if @user.save …
Run Code Online (Sandbox Code Playgroud) 我找不到phpStorm 5的功能,以避免索引特定的文件夹.我不想将它从Project-View中排除,只是不希望phpStorm索引包含文件夹,类,函数等.
怎么可能?
我正在使用表格在每个页面上创建一个页脚(在Firefox中运行,这就足够了).
JS小提琴:https://jsfiddle.net/j9k2xzze/
(右键单击输出窗格 - >此框架 - >在新选项卡中打开框架.然后打印预览将正常运行)
<table id="wrapper">
<thead>
<tr>
<td id="header"></td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="0" id="footer">
<img src="footer.jpg"/>
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td id="content">
<?php echo $html; ?>
</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
但是在最后一页上,表格页脚直接显示在文本下方.如果文本比最后一页短,则页脚会粘到它上面.
我喜欢页脚在最后一页的最底部.不幸的是@page扩展名在firefox中不起作用,或者我做错了:
@page:last {
#footer {
position: absolute;
bottom: 0;
}
}
Run Code Online (Sandbox Code Playgroud) 我最近使用docker image gitlab/gitlab-runner:9.1.0与gitlab容器一起使用了一些CI.发生错误并使用不同的版本推荐类似的支持请求,所以我尝试了:latest
一些:1.11
也是.不幸的是它一直告诉我这个错误:
Running with gitlab-ci-multi-runner 1.11.4 (5e7ba4a)
on foo (02cdacdc)
Using Docker executor with image pretzlaw/php:7.1-apache ...
Starting service mariadb:latest ...
Pulling docker image mariadb:latest ...
Waiting for services to be up and running...
Pulling docker image pretzlaw/php:7.1-apache ...
Running on runner-02cdacdc-project-7-concurrent-0 via 9d1d33dc9212...
Fetching changes...
HEAD is now at 7580815 QA: CI Lint
From http://idgaf.example.org/foo/bar
7580815..affeede develop -> origin/develop
Checking out affeede as develop...
Skipping Git submodules setup
[: 1: [: Syntax …
Run Code Online (Sandbox Code Playgroud) 我测试了我的工具包并得到了这个输出
PHPUnit 3.7.21
Configuration read from php-application-toolkit/dev/Test/phpunit.xml
............................................................... 63 / 119 ( 52%)
........................................................
Run Code Online (Sandbox Code Playgroud)
在某些时候,有一条新线,所有其他点都去那里.即使所有测试都正确,百分比也不是100%.
这里有什么不对?这有意义吗?
所有相关文件都在这里:http://github.com/sourcerer-mike/php-application-toolkit/tree/release-0.2
我喜欢运行一个像这样快照凸轮的cron:
* 9-17 * * 1-5 vlc -I dummy v4l2:///dev/video0 --video-filter scene --no-audio --scene-path /home/foo/tmp/cam --scene-prefix snapshot --scene-format png vlc://quit --run-time=1
Run Code Online (Sandbox Code Playgroud)
但是当cron运行它时会抛出一个我不明白的错误:
** Message:
Failed to get session bus:
Error spawning command line 'dbus-launch --autolaunch=55644972b3c91c1d24d83d8252721f00 --binary-syntax --close-stderr':
Child process exited with code 1
Run Code Online (Sandbox Code Playgroud)
在网络上,我发现没有干净或良好的文档.你能帮我解决一下吗?