首页 > 学院 > 开发设计 > 正文

ruby on rails 常用的记录

2019-11-11 03:20:42
字体:
来源:转载
供稿:网友

撤销操作: https://railstutorial-china.org/book/chapter3.html#aside-undoing-things

HTTP 超文本传输协议 https://railstutorial-china.org/book/chapter3.html#aside-get-etc

测试 https://railstutorial-china.org/book/chapter3.html#aside-when-to-test

视图中使用 ruby

# 嵌入式 Ruby 代码# 设置参数<% PRovide(:title, "The Title") %># 调用参数<%= yield(:title) %>

定义辅助方法 app/helpers/application_helper.rb

module ApplicationHelper # 根据所在的页面返回完整的标题 def full_title(page_title = '') base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else page_title + " | " + base_title end endend
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表