简体   繁体   中英

Setting dynamic placeholder text in rails

I'm fairly new to rails. I'm building an app that has 5 templates for 5 forms. I don't really need to build 5 forms, just somehow replace the placeholder text depending on the template. What is the best way to do this? A helper file? What would the process be called so I can look it up?

put the text you need into an @instance_variable inside your controller and then you'll have access to that in your view templates.

Then, do some business logic on the backend to determine what text that variable will hold.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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