Reputation: 6662
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...
Upvotes: 1
Views: 63
Reputation: 2683
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...
Upvotes: 2