开发者

More dry views?

I have a simple index page for clients. Client has 20 fields. I am displaying list of clients in a table. For this I have to write in my views something like:

- @clients.each do |client|
  %tr
   %td=client.name
   %td=client.email
   %td=client.address
   %td=client.phone etc...

I am just curious if I 开发者_运维知识库can do it something like

- @clients.each do |client|
  - client do
      %tr
       %td= name
       %td= email
       %td= address
       %td= phone etc...


I think you could do something like

- @clients.each do |client|
  - client.instance_eval do
      %tr
       %td= name
       %td= email
       %td= address
       %td= phone etc...
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜