我需要检查一下
"Apple" == "Apple" # returns TRUE
"Apple" == "APPLE" # returns FALSE
Run Code Online (Sandbox Code Playgroud)
在Ruby中.
我需要一个字符串比较,但检查不区分大小写.
我正在使用devise
注册/进入.
路线
get 'profile' => 'profile#get_profile'
post 'profile' => 'profile#create_profile'
Run Code Online (Sandbox Code Playgroud)
和profile_controller
def get_profile
render json: {user: current_user}, status: :ok
end
def create_profile
render json: {user: current_user}, status: :ok
end
Run Code Online (Sandbox Code Playgroud)
GET: http:// localhost:3000/user/profile返回预期的输出.然而,
POST请求引发错误说:
ActionController::InvalidAuthenticityToken in User::ProfileController#create_profile
.
请揭开这种行为的神秘面纱.
我正在使用codeigniter并一次插入一条记录.但问题是$ this-> db-> insert_id(); 每次返回0,但记录成功创建.我无法弄清楚.这是通常的情况还是我做了一些愚蠢的错误.我使用email_id作为主键,而移动号码不是唯一的.
这是我的模态代码:
function signup_insert($data) {
$result = $this->db->insert('registration_detail', $data);
$insert_id = $this->db->insert_id();
return $insert_id;
}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器代码:
function insert_signup() {
$email = $this->input->get('email');
$name = $this->input->get('name');
$password1 = $this->input->get('password1');
$password2 = $this->input->get('password2');
$phone = $this->input->get('phone');
$country = $this->input->get('country');
$data = array(
'email' => $email,
'name' => $name,
'pwd' => $password1,
'phone' => $phone,
'country' => $country
);
$insert_id = $this->signup->signup_insert($data);
print_r($insert_id);
}
Run Code Online (Sandbox Code Playgroud) 我使用的是RubyMine 8.0.3,我有3个文件夹和2个.rb
文件controller/api/v1
,3个文件夹中没有一个可见,但两个.rb
文件都可见.我重新打开了IDE但没有任何反应.我还尝试了以下链接中提到的解决方案:RubyMine Folder Tree不刷新
注意:
1:当我在sublime中打开我的项目时,所有文件夹都可见.
2:我在.gitignore文件中添加了.idea /.
我有一个"2015-11-01T10:00:00.00+08:00"
从json响应中提取的字符串.如何将其转换为时间或日期时间?
我尝试了Time.new("2015-11-01T10:00:00.00+08:00")
它的返回2015-01-01 00:00:00 +0530
,显然日期在这里也改变了.
我正在尝试使用两种不同的方式构建一个docker flink容器,通过Dockerfile和Docker组合.Dockerfile工作正常,但我在使用Docker编写时遇到了一些麻烦.
在执行yml文件后进行了一些重新研究(如果我已经正确理解),docker会检查将要使用的服务,并验证是否已拉出所需的图像,如果缺少任何图像,则docker启动拉动过程.问题是默认情况下,docker会拉出image:latest标签,我对特定标签感兴趣.
我试图在执行docker-compose.yml文件之前拉出image:标签,但尽管如此,Docker组合忽略已经拉过的图像并开始下载图像:最新标签
有什么机制可以做到吗?
我不知道它是否对回答这个问题很有用,但是我附上了我的yml代码:
version: "2.1"
services:
jobmanager:
image: ${FLINK_DOCKER_IMAGE_NAME:-flink}
expose:
- "6123"
ports:
- "8081:8081"
command: jobmanager
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
taskmanager:
image: ${FLINK_DOCKER_IMAGE_NAME:-flink}
expose:
- "6121"
- "6122"
depends_on:
- jobmanager
command: taskmanager
links:
- "jobmanager:jobmanager"
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
Run Code Online (Sandbox Code Playgroud)
谢谢
ruby ×3
apache-flink ×1
codeigniter ×1
devise ×1
docker ×1
mysql ×1
php ×1
rubymine ×1
string ×1