-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
想請教一下幾個問題。 #52
Comments
參考意見(新手怕講錯先講~呵)
|
預設instance variable不會有指定值,會回傳
Rails Console底下只需要model不用其他東西。至於在瀏覽器當中,Rails是由router去分配給controller,所以基本上一定會先到router,這題答案就是「無」。
可以統一放,但我建議是用partial切開。
要看你上傳照片是使用哪個gem或如何實作,例如Carrierwave是用uploader去掛載到model上,所以可以使用同一個uploader去掛載到不同model上 (儘管不符合Rails邏輯)
資料驗證的內容是? |
另外,建議不同類型的問題可以分開成不同issue來提問,這樣比較方便了解不同問題的人來回答喔~ |
|
|
關於第 3 個問題: 我會偏好把 Google 分析碼獨立載入,放在讀取 application.js 之前。 HTML5 Boilerplate 有提到 Google 建議把 GA code 放在頁面前面越早載入越好,是為了達到追蹤目的,放在 application.js 裡面要等東西載完才能執行 GA 太慢了,尤其 application.js 體積肥大的時候。 評估自己的情境跟目的,再來決定放哪裡。 |
@afgnsu 我會用 inline 的方式寫耶:
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X','auto');ga('send','pageview');
</script> 而且我會把 script 放到頁面最底下,最後載入。
<body>
...
<%= render "google_analytics" %>
<%= javascript_include_tag 'application' %>
</body> |
感謝大家,我再試試 ^_^ |
The text was updated successfully, but these errors were encountered: