您的位置:首页 > 大数据 > 人工智能

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐