custom rails3 scaffold template by your self
2010-10-31 23:20
260 查看
i cost 2 day to find this out,hope help someone .
the rails3 provide a way to custom the scaffold code
when i use rails g scaffold_controller admin/Product name:string to separate the backend code from frontend.
the crud code didn't woks well due to the generate code has some bug,it's only suit for
rails g scaffold Product name:string this Product is on the root level.
so i need custom the scaffold tempate
bellow is the detail:
put the attachment under lib folder and untar them
this code i have tested both suit above situation
-- lib
| |-- tasks
| |-- templates
| | |-- erb
| | | `-- scaffold
| | | |-- edit.html.erb
| | | |-- _form.html.erb
| | | |-- index.html.erb
| | | |-- new.html.erb
| | | `-- show.html.erb
| | `-- rails
| | `-- scaffold_controller
| | `-- controller.rb
i have hack the default template code suit for my situation,also i think this is a common way,may be rails3 need patch it as default
http://files.cnblogs.com/lexus/templates.zip
the rails3 provide a way to custom the scaffold code
when i use rails g scaffold_controller admin/Product name:string to separate the backend code from frontend.
the crud code didn't woks well due to the generate code has some bug,it's only suit for
rails g scaffold Product name:string this Product is on the root level.
so i need custom the scaffold tempate
bellow is the detail:
put the attachment under lib folder and untar them
this code i have tested both suit above situation
-- lib
| |-- tasks
| |-- templates
| | |-- erb
| | | `-- scaffold
| | | |-- edit.html.erb
| | | |-- _form.html.erb
| | | |-- index.html.erb
| | | |-- new.html.erb
| | | `-- show.html.erb
| | `-- rails
| | `-- scaffold_controller
| | `-- controller.rb
i have hack the default template code suit for my situation,also i think this is a common way,may be rails3 need patch it as default
http://files.cnblogs.com/lexus/templates.zip
相关文章推荐
- sharepoint 2013 根据网站模版创建网站,并赋值网站权限 create a site by custom site template
- Tailor Your Application by Building a Custom Forms Designer with .NET
- sharepoint 2013 根据网站模版创建网站,并赋值网站权限 create a site by custom site template
- Tailor Your Application by Building a Custom Forms Designer with .NET
- Add reference count capability to your class with a template class
- How to remove Oracle Database from your computer---By Roger Gong
- 非常好的思想 (Design your web pages freely at runtime - by Jasper)
- Building your Recurrent Neural Network - Step by Step参考答案
- 如何使用 @ OutputCache 指令的 VaryByCustom 属性来缓存不同版本的页面
- Your branch is ahead of 'origin/master' by 1 commit
- SharePoint 2013 Step by Step——使用自定义的List Template
- 【十一年】注入框架RoboGuice采用:(Your First Injection into a Custom View class)
- git pull 时出现 error: Your local changes to the following files would be overwritten by merge的解决办法
- [NPM] Use custom config settings in your npm scripts
- [Angular] Implement a custom form component by using control value accessor
- three main situations and corresponding recommendations for building your custom extensions to the E-Business Suite
- using the masterpage from your site in custom _layouts pages
- Could not find gem 'sass-rails (~> 5.0) x64-mingw32' in any of the gem sources listed in your Gemfil
- RadRails 0.7.0 by RadRails team
- Your local changes to the following files would be overwritten by merge: