Friday 10 June 2016

How to create dropdown in active_admin using scope


     1.First create scope in your model like this :-
         
           1.  scope :generalnews, -> { where(news_type: 'generalnews') }
   2.  scope :ceonews, -> { where(news_type: 'ceonews') }

      2. in active_admin

   f.input :news_type, :collection => News.all.map{|u| [u.news_type, u.id]}

  

1 comment:

Revert last commit or second last and more....

 Git revert commit_id -m 1 this command willl revert last commit  Git revert commit_id -m 2 this command will revert second commit with same...