Posts

Showing posts with the label active admin gem

How to customise active admin page on keypress

Image
How to customise active admin page on keypress First make new route for getting filtered data: get '/admin/gyms/search_user', :to => 'admin/gyms#search_user', as: :search_gym_user In your controller create new method def search_user      @user =  User.where("name = ? AND role = ?", params[:name], "none") if params[:name].present?      respond_to do |format|        format.json  { render :json => @user }      end    end Render partial and add a id to to table panel "Gym Users:", :id => "foo-panel" do      # renders app/views/admin/posts/_search_users.html.erb       render 'search_users', { users: gym.users }      table_for gym.users, id: "search_gym_user" do        # binding.pry        # filter :"name" , :as => :select, :collection => gym.users.pluck(:name)        column "Joined" do |user|          distance_of_time_in_words(user.created_at, Time.now)    

Make admin panel with Active admin rails || active_admin rails

Image
Make admin panel with Active admin rails || active_admin rails  Open Terminal and copy and paste this Command rails new admin_example // creating new rails application go inside the project cd admin_example run bundle install bundle install open your gem file and add this new gem's gem 'activeadmin' / / for active admin panel gem 'inherited_resources' //  making your controllers inherit all restful actions gem 'devise' // for user authentication  run bundle install again bundle install install active admin rails g active_admin:install / /install active admin to your project migrate database rake db:migrate check your seed file and run rake db:seed create user file and model rails g User name email  create post file and model rails g Post title body:text published_at:datetime user:references Now Migrate DataBase rake db:migrate start rails server rails s Hit url localhost:3000/admin/login Enter login details you can find login