lib/generators/templates/app/controllers/base.rb in beautiful_scaffold-0.0.8 vs lib/generators/templates/app/controllers/base.rb in beautiful_scaffold-0.1.0
- old
+ new
@@ -3,11 +3,12 @@
# Official Rails version : master/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
before_filter :load_<%= model %>, :only => [:show, :edit, :update, :destroy]
def index
- #@<%= model_pluralize %>
-
+ session[:fields] ||= {}
+ session[:fields][:<%= model %>] ||= (<%= model_camelize %>.columns.map(&:name) - ["id"])[0..4]
+ do_select_fields(:<%= model %>)
do_sort_and_paginate(:<%= model %>)
@q = <%= model_camelize %>.search(
params[:q]
)