1、新建字段

//rails g migration add_字段名_to_表名 字段名:字段类型
rails g migration add_title_to_contents title:string

2、

rails db:migrate

3、/views/users/index.html.erb

对应位置添加
<td><%= user phonenumr%></td> 对应位置添加
<th>phontnum<th>

4、/users_controller.rb

def user_params
params.require(:user).permit(:name, :email,:QQ,:Signature,:phonenum)//phonenum为新增
end

5、_form.html.erb添加相应内容

6、git push heroku&&heroku run rails db:migrate

rails 新建user的phonenumber字段的更多相关文章

  1. mysql新建表示,时间字段timetamp碰到的问题

    在mysql中创建表时,在新加的字段时间上,碰到下面的问题: 建表语句如下: CREATE TABLE seckill( seckill_id bigint NOT NULL AUTO_INCREME ...

  2. [QualityCenter]设置工作流脚本-新建缺陷时描述字段模板设置

    需求:实现新建缺陷时,描述模板自动生成填写模板. 在脚本编辑器找到Defects_Bug_New函数,然后填写以下代码: Sub Defects_Bug_New    On Error Resume ...

  3. Rails中重写Active Record字段属性

    系统重构或升级时偶尔会碰到需要重写某个字段的情况,例如: 1. 读取user的name字段时,实际返回name_new字段 class User < ActiveRecord::Base def ...

  4. mysql 上传数据到指定字段

    新建表prizecode,字段为code varchar(45) not null , usedAt TIMESTAMP;数据存放在 E:\prizecode\ 目录下,下面是上传语句 LOAD DA ...

  5. 数据库字段出现科学计数法e+的情况分析

    问题: 有时候,我们在将excel表格中数据导入数据库中时,对于表格中的数字会默认为float的数据类型,这个时候导入到数据库中的这个表的值是正常显示的: 然而如果你要把导入到数据库中的表,再插入到另 ...

  6. win7安装ruby on rails

    开发机:win7 旗舰版 - 64位 1,安装ruby,下载rubyinstaller-2.0.0-p451.exe 下载地址:http://rubyinstaller.org/downloads/ ...

  7. win7安装ruby on rails开发环境

    前言 我们看到很多文章说ruby环境windows它是非常困难的基础上,这将是各种稀奇古怪的问题,因此,建议linux和mac发. 可是我依照教程搭了下,问题也不算太多.总过大概花费了2个半小时左右就 ...

  8. 开发MOSS自定义字段类型

    前段时间,由于刚好项目定制的需要,笔者就开发了几个自定义字段类型.在这抽空做个详细笔记,方便初学者学习.这方面的资料也很多,如果自身觉得不大明白可以参考下SDK和网上的相关文章.本章的目的主要是给新手 ...

  9. 012.Adding a New Field --【添加一个新字段】

    Adding a New Field 添加一个新字段 2016-10-14 3 分钟阅读时长 作者 By Rick Anderson In this section you'll use Entity ...

随机推荐

  1. 2019年华南理工大学程序设计竞赛(春季赛)-C-六学家的困惑

    题目链接:https://ac.nowcoder.com/acm/contest/625/C 题意:给定两个字符串,每次只能从两个字符串的两端取字符,求依次取字符后所构成的数字最大为多少. 思路:思路 ...

  2. Attention Please

    关于BJJ与Matlab的学习时间安排在五六日晚间: 其余一切重心在学术!

  3. JS中DOM以及BOM

    一.bom对象 1screen对象 console.log(screen.width);// 屏幕宽度 console.log(screen.height);// 屏幕高度 console.log(s ...

  4. gdb打印C++容器

    将以下内容保存成 .gdbinit 文件放到你的根目录,或者在gdb中source这个文件可以加载. 直接print容器即可. # # STL GDB evaluators/views/utiliti ...

  5. selenium验证码和错误截图

    验证码的识别: 1,破解验证码 OCR识别(一般使用tesseract-ocr) 人工智能(AI机器学习 TensorFlow,成本大) 2,绕过验证码 1, 让开发人员临时关闭验证码 2,提供万能验 ...

  6. input 与raw_input的区别

    input只能输入数字 raw_input 既可以输入数字也可以输入字符串 >>> input("input you name:") input you name ...

  7. nginx: [emerg] mkdir() "/var/temp/nginx/client" failed (2: No such file or directory)

    报错信息 [root@bogon sbin]# ./nginx nginx: [emerg] mkdir() : No such file or directory) 解决方法 [root@bogon ...

  8. 使用go语言的list实现一个简单的LRU缓存

    package main; import ( "container/list" "errors" "sync" "fmt" ...

  9. Comparing Code Playgrounds Codepen, JSFiddle, JS Bin, Dabblet, CSS Deck, and Liveweave

    What is a code playground? Codepen, JSFiddle, JS Bin, Dabblet, CSS Deck, and Liveweave are HTML, CSS ...

  10. tiny4412SDK 1312B 启动ubuntuDsektop

    1,解压光盘所带文件ubuntu-desktop-sdcard-image-YYYYMMDD.tar.gz , 得到ubuntudesktop-8g.raw 2,先用SD-flash刷写一边B盘ima ...