我通过"rails generate model User name:string email:string ..."创建了一个用户表,同时创建了迁移文件.
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :email
t.timestamps
end
end
end
Run Code Online (Sandbox Code Playgroud)
现在我想在"跟随教程"的电子邮件列中添加一个索引.我第一次成功地使用sqlite3完成了这项工作.第二次通过im使用MySql(mysql2).再次使用生成模型创建表格.当我运行以下内容时:
rails generate migration add_index_to_users_email
Run Code Online (Sandbox Code Playgroud)
该过程以没有错误消息结束并创建迁移文件,如下所示,但没有任何索引的设置..
class AddIndexToUsersEmail < ActiveRecord::Migration
def change
end
end
Run Code Online (Sandbox Code Playgroud)
我希望add_index :users, :email, unique: true在那里看到 ...任何人有任何想法..搜索其他线程无济于事.运行rails 4,mysql 5.6 ruby 1.9.3我在initil db:migrate之后创建的架构是:
ActiveRecord::Schema.define(version: 20131024161033) do
create_table "users", force: true do |t|
t.string "name"
t.string "email"
t.string "city"
t.string "state"
t.string "zip"
t.string "mobile_phone"
t.string "mobile_phone_type"
t.date "birth_date"
t.string "user_type"
t.string …Run Code Online (Sandbox Code Playgroud) 我刚刚设置了我的第一个需要ssl的应用程序.
它是RoR应用程序,托管在Heroku上.
我已将SSL Endpoint插件添加到我的应用程序中.我从DNSimple购买了SSL证书.
然后按照这些说明 - https://devcenter.heroku.com/articles/ssl-certificate 连接必要的文件.然后将它们上传到我的服务器.
到现在为止还挺好.
遵循这些说明 - https://devcenter.heroku.com/articles/ssl-endpoint#testing-your-certificate 用于测试我的证书似乎没问题.
我已经使用指向我的Heroku生成的端点的CNAME更新了我的DNS记录.
heroku certs
Run Code Online (Sandbox Code Playgroud)
得到:
Endpoint Common Name(s) Expires Trusted
---------------------------- -------------------------------------- -------------------- -------
<generated_id>.herokussl.com www.mydomain.com, mydomain.com 2014-04-29 23:25 UTC True
Run Code Online (Sandbox Code Playgroud)
但是当我尝试:
curl -v https://www.mydomain.com
Run Code Online (Sandbox Code Playgroud)
我明白了:
* About to connect() to www.mydomain.com port 443 (#0)
* Trying 107.20.162.205... connected
* Connected to www.mydomain.com (107.20.162.205) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* …Run Code Online (Sandbox Code Playgroud)