แสดงบทความที่มีป้ายกำกับ ruby แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ ruby แสดงบทความทั้งหมด

วันอาทิตย์ที่ 13 มีนาคม พ.ศ. 2554

ruby: Can I set primary key in model ?

ให้ใช้ options hash ที่มี key ที่ชื่อว่า :primary_key ตามตัวอย่าง

create_table :countries ,:primary_key => :code do |t|
t.string :code, :limit => 2, :null => false
t.string :iso_a3, :limit => 3, :null => false
t.string :name, :null => false
t.timestamps
end

วันอังคารที่ 22 กุมภาพันธ์ พ.ศ. 2554

ruby: Failed to build the native extension in Ruby

ปัญหา
ถ้ามี error : Failed to build the native extension in Ruby หลังจากใช้ gem insatll
แก้ไข
ใช้ DevKit เพื่อแก้ไข ตามลิงก์นี้เลย https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

วันอังคารที่ 4 มกราคม พ.ศ. 2554

ruby : Comment in html.erb

Comment :
single line
<%-# ................ -%>
multi-line
<% if false %>
.....
.....
.....
<% end %>

วันศุกร์ที่ 24 ธันวาคม พ.ศ. 2553