接續上一篇,這一篇要用chart.js來畫圖表。
這次收到的題目是用Sinatra來看國際貨幣的匯率狀況,這是參考資料的網址 https://data.gov.tw/dataset/31897
第一題for ruby
這一題我的作法是將sq值開根號之後,再用.round去做四捨五入後再做一次平方,得出來的值如果跟sq值一樣的話,將sq開根號的值加1之後平方回傳,其餘達不到開根號取四捨五入在平方等於sq條…
RubyOnRail =>練習專案筆記(一)
由於把筆記做到XMind或者是程式碼裡面實在不好閱讀,比如下面的情況。
首先我們要在首頁畫面將所有候選人的資料全部顯示出來,所以我們先到controllers,在index這個方法上將資料庫的候選人資料撈出來,我們建立一個實體變數,將Candidate.all賦予給他,其用意為將所有資料全部撈出來。
接續上一章節,我要要如何處理那個錯誤呢,首先我們要在create方法加入一個clean_params這個變數。
Rails的Modle關聯性很重要,尤其是在有會員系統的網頁上,其中的多種關聯性必須要很清楚,避免在後面的Modle設計上不良,這篇先對一對一的關聯做做練習,順便做個筆記。
在來我們要來處理如果表單內的內容有漏填或者是填寫不正確我們要來如何處理這些問題。
接續上次專案,由於我們可以直接對網頁案右鍵檢視原始碼,所以有心人可以針對這樣子去塞假資料,所以在rails裡如果要提交表單需要給一串算是認證碼的東西,所以我們需要在表單裡面增加一個隱藏欄位。
These were the top 10 stories published by ck100pro in November of 2019. You can also dive into daily archives for November of 2019 by using the calendar at the top of this page.