zoukankan      html  css  js  c++  java
  • custom rails3 scaffold template by your self

    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 

    https://files.cnblogs.com/lexus/templates.zip

  • 相关阅读:
    DLL文件的原理
    OD使用教程7(上) 调试篇07|解密系列
    复制独立数组的方法
    [转载 js] js正则表达式
    中国雅虎ued成员
    复制独立数组的方法
    [转载 js] js正则表达式
    以前做的flash相册
    编程的幽默
    我最早的全flash站
  • 原文地址:https://www.cnblogs.com/lexus/p/1865828.html
Copyright © 2011-2022 走看看