所以我试图在路由/[project_name]/edit
扩展项目设置页面的功能,视图文件存储在app/views/projects/edit.html.haml
。
问题是我找不到该视图的相应控制器。我尝试修改edit.html.haml
并输出变量controller_name
和action_name
,以确定呈现特定视图的内容。其中控制器名称为:“projects”,操作名称为“edit”。
这使我进入app/controllers/projects_controller.rb
并修改了内部的edit
函数,但我的ruby实例变量似乎都不可见。作为一个完整性检查我已经注释掉了:
render 'edit', layout: "project_settings"
检查app/views/projects/edit.html.haml
是否甚至呈现......而且确实如此。
我甚至在第一时间编辑正确的文件,还是我偏离轨道?
二手资料来源:
http://doc.gitlab.com/ce/development/architecture.html
http://guides.rubyonrails.org/getting_started.html(因为我是Rails的新手)
我还没有成功使用以下命令检查我的Rails路由:bundle exec rake routes --trace
输出:
rake aborted!
LoadError: cannot load such file -- rb-inotify
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:76:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:72:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:72:in `block in require'
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:61:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:61:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:132:in `require'
/home/git/gitlab/config/application.rb:6:in `<top (required)>'
/home/git/gitlab/Rakefile:5:in `require'
/home/git/gitlab/Rakefile:5:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
在params[:id]
中打印edit.html.haml
,我发现正确的路线是我通过rake routes
找到的以下路线:
edit_project GET /:id/edit(.:format) [no_controller_in_this_column]
我现在唯一的问题是:如果似乎没有连接控制器,我可以在哪里编辑此路线的功能?