[root@h202 blog]# rails generate controller Comments
Running via Spring preloader in process 3855
create app/controllers/comments_controller.rb
invoke erb
create app/views/comments
invoke test_unit
create test/controllers/comments_controller_test.rb
invoke helper
create app/helpers/comments_helper.rb
invoke test_unit
invoke assets
invoke coffee
create app/assets/javascripts/comments.coffee
invoke scss
create app/assets/stylesheets/comments.scss
[root@h202 blog]# cat app/controllers/comments_controller.rb
class CommentsController < ApplicationController
end
[root@h202 blog]# cat app/views/comments
cat: app/views/comments: Is a directory
[root@h202 blog]# ll app/views/comments
total 0
[root@h202 blog]# cat test/controllers/comments_controller_test.rb
require 'test_helper'
class CommentsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
[root@h202 blog]# cat app/helpers/comments_helper.rb
module CommentsHelper
end
[root@h202 blog]# cat app/assets/javascripts/comments.coffee
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
[root@h202 blog]# cat app/assets/stylesheets/comments.scss
// Place all the styles related to the Comments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
[root@h202 blog]#
File name | Comment |
---|---|
app/controllers/comments_controller.rb | Comments 控制器文件 |
app/views/comments | 控制器的视图存放在这个文件夹里,目前是空的 |
test/controllers/comments_controller_test.rb | 控制器测试文件 |
app/helpers/comments_helper.rb | 视图帮助方法文件 |
app/assets/javascripts/comments.coffee | 控制器的 CoffeeScript 文件 |
app/assets/stylesheets/comments.scss | 控制器的样式表文件 |
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。