Conditionally setting CSS style from ruby controller

前端 未结 5 1641
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 11:07

I\'m trying to dynamically change (if it got clicked) a normal table header (which is a link) to another defined CSS class \'th.hilite\'. This link simply sorts this column and

5条回答
  •  渐次进展
    2021-02-01 11:34

    BTW as long as values of your param match column name - no need to code each one

    def index
        @by=params[:by]
        @movies = Movie.order(params[:by]).all
      end
    

提交回复
热议问题