Display only the desired parameters

后端 未结 1 1092
陌清茗
陌清茗 2021-01-28 12:11

I created an app following this tutorial (without scaffolding).

After I create an item I can click on it and it shows me a big list of parameters. Like here: http://s15

相关标签:
1条回答
  • 2021-01-28 13:13

    You need to add view files for todo resource. If you're scaffolding, then geddy creates them by default. But otherwise, you have to add view files for todo in app/views/todos.

    View files

    • _form.html.ejs
      • edit/new form
    • add.html.ejs
      • new resource view
      • /todos/add
    • edit.html.ejs
      • edit view
      • /todos/:id/edit
    • index.html.ejs
      • index view
      • /todos
    • show.html.ejs
      • show individual resource
      • /todos/:id

    You can edit them manually. For changing how a individual todo item should appear on /todos/:id route, edit show.html.ejs

    <div class="hero-unit">
      <%- linkTo('Edit this todo', editTodoPath(params.id), {class: 'btn pull-right'}); %>
      <h3>Params</h3>
      <ul>
        <li>todo.title</li>
        <li>todo.property1</li>
        <li>todo.property2</li>
      </ul>
    </div>
    
    0 讨论(0)
提交回复
热议问题