小编Tag*_*ag0的帖子

应用程序控制器中的before_filter仅用于获取请求

我需要在我的ApplicationController中设置一个before_filter,如果用户尚未同意新的服务条款,则会重定向用户.但是,我想将过滤器限制为仅根据请求类型运行.

我想写这样的东西:

class ApplicationController

before_filter :filter, :only => {:method => :get}
Run Code Online (Sandbox Code Playgroud)

这样的事情可能吗?

ruby-on-rails before-filter ruby-on-rails-3

5
推荐指数
1
解决办法
2178
查看次数

使用BFG repo-cleaner后检查git repo

非常基本的git问题:

我向Github上传了一些妥协信息,并使用bfg来清理回购.我按照文档执行了以下操作:

$ git clone --mirror git://example.com/some-big-repo.git
$ bfg --replace-text passwords.txt  my-repo.git
Run Code Online (Sandbox Code Playgroud)

我收到了以下输出:

Found 233 objects to protect
Found 9 commit-pointing refs : HEAD, refs/heads/experimental, refs/heads/master, ...

Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

 * commit 497fc1c8 (protected by 'HEAD')

Cleaning
--------

Found 80 commits
Cleaning commits:       100% (80/80)
Cleaning commits completed in 301 ms.

BFG aborting: No refs to update - no dirty commits found??
Run Code Online (Sandbox Code Playgroud)

我想看看私人信息是否已从我的仓库中清除,但我不确定如何检查镜像仓库中的文件.有任何想法吗?

git github repository git-rewrite-history bfg-repo-cleaner

4
推荐指数
1
解决办法
3201
查看次数

如何将更新CASCADE添加到Rails-Postgres迁移中?

我需要编写一个Rails迁移,该迁移将更新特定对象的uuid,然后通过将该ID作为外键存储的所有行进行CASCADE,如下所示:

alter table projects add constraint fk_league
foreign key (user_id) references users(id) on update cascade
Run Code Online (Sandbox Code Playgroud)

不幸的是,Rails似乎会自动生成约束:

fk_rails_e4348431a9
Run Code Online (Sandbox Code Playgroud)

我将如何编写上述sql来处理此问题?

sql postgresql ruby-on-rails foreign-keys rails-migrations

4
推荐指数
1
解决办法
1485
查看次数