[問題] 想問一個~ rails 網頁對應的問題~

看板Ruby作者 (mimi)時間17年前 (2007/10/13 13:12), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串1/1
最近想自己寫一個網頁的程式~(不用rails) 但是我遇到的一個瓶頸 就是 我該怎麼 將class 和所想要的網頁對應 譬如在rails 有一個上傳檔案的表單 <form action="create" method="post" enctype="multipart/form-data"> <p> <b>Name:</b><br /> <%= text_field "person", "name" %> </p> <p> <b>Picture:</b><br /> <input type="file" name="person[picture]" /> </p> <p><input type="submit" name="Save" /></p> </form> 那他所對應的 action="create" 可以在 class 裡 找到對應的 method class AddressbookController < ApplicationController def create post = Post.save(@params["person"]) # Doesn't this mean post is a File object? # post.id is a bad idea in this case... redirect_to :action => "show", :id => post.id end ... ... end 有點摸不著頭緒 他這樣是如何去實做 對應的方法 想請各位高手 可以提點一下嗎? 我在網路上找有關資料很少 不知到各位對這樣的對應關係 要如何去解決??? 先謝謝各位~ 或是拿裡有很好的參考範例 可以讓我參考~~~~ -- ▁▁ ▕寧寧▏ ▕肥肥▏  ̄ ̄ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.192.244.63

10/13 15:48, , 1F
這當然是看 rails source 最快啊 XD
10/13 15:48, 1F

10/13 15:49, , 2F
這應該跟 route 和 server 有關吧?
10/13 15:49, 2F
文章代碼(AID): #1745F0_e (Ruby)
文章代碼(AID): #1745F0_e (Ruby)