开发者

Ruby, Getting a list count from a Param?

开发者 https://www.devze.com 2023-02-26 02:48 出处:网络
in my Rails 3 app, I have a form that posts XXX,XXXXXXXX What I want to be able to do is something like so:

in my Rails 3 app, I have a form that posts XXX,XXXXXXXX What I want to be able to do is something like so:

params[开发者_开发百科:myfield].count
or 
params[:myfield].size

But that always returns 1, how can I get a count for the number of items by comma separation?

Thanks


params[:myfield].split(",").size
0

精彩评论

暂无评论...
验证码 换一张
取 消