I want to use "columns" instance variable in partial file defined in the controller and it is working, but I would like to know is there better ways to do it ?
Controller:
def index
### code here ####
@columns= []
Model.column_names.each do |col|
cnd = "#{col}"
if cnd == 'id' || cnd == 'abc_id' || cnd == "created_at" || cnd =="updated_at"
next
end
@columns << cnd
end
end
index.html.haml
%fieldset.form-columned
.row-fluid
#### code here ######
= render :partial => 'admin/partial', locals: {columns:@columns}
in partial file : _partial
- columns.each do |cols|
%tbody
%td #{cols}
%td