Chen Log

陳洛格

can’t convert Fixnum into String

leave a comment »

スクリーンショット 2013 09 16 20 31 14

 

原本程式,
修改前:

<%= keyin.sale_price.rjust(12,0) %>

 

修改後:
<%= keyin.sale_price.rjust(12,’0′) %>
或是: 
<%= keyin.sale_price.to_s.rjust(12,’0′) %>

 

注意!就是『零』左右兩邊的引號有打錯變成其他字形或是數字無法轉換成字串。

Advertisements

Written by chenagw

2013/09/16 at 20:49

Posted in Uncategorized

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: