简体   繁体   English

使用Rails 3在输入文本字段中添加值

[英]Adding value in input text field using Rails 3

I have a small problem.I want to add value inside the input text field which is fetching from DB. 我有一个小问题,我想在从DB获取的输入文本字段内添加值。

Suppose i have a input field like below. 假设我有一个像下面这样的输入字段。

<input type="text" class="form-control" placeholder="Receipt No"> 

I have to add @user.Receipt_No inside it as its value.This value is fetching from user table of DB.Please help me resolve this problem. 我必须在其中添加@user.Receipt_No作为其值。此值是从DB的用户表中获取的。请帮助我解决此问题。

尝试这个,

<input type="text" class="form-control" placeholder="Receipt No" value="<%= @user.Receipt_No %>">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM