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...
精彩评论