Skip to content

Instantly share code, notes, and snippets.

@dohoonk
Created March 17, 2016 22:15
Show Gist options
  • Save dohoonk/ba4b01ed98b0ae422fc6 to your computer and use it in GitHub Desktop.
Save dohoonk/ba4b01ed98b0ae422fc6 to your computer and use it in GitHub Desktop.
Active Admin/alternative to ERB

##Active Admin

This will fetch the latest from git

gem 'activeadmin', github: "activeadmin/activeadmin"

active admin depends on gem 'devise'

gem 'devise'

if you are getting an error try using older version of devise

bin/rails generate active_admin:install
bin/rake db:migrate

after follow the instruction on console

In your routes/seeds you will see some code addes bin/rake db:seed

This might raise a conflict with your sign_in method in your sessions controller rename the method sign_in user_sign_in

Your admin panel will be empty because you have not generated any models yet

bin/rails g active_admin:resoucre question
bin/rails g active_admin:resoucre answer
bin/rails g active_admin:resoucre tag
bin/rails g active_admin:resoucre category
bin/rails g active_admin:resoucre user

You must adjust app/admin/questions and copy the params code in to the file

assits-stlyesheets-application.css In your application.css Add this code to *= stub active_admin

alternative to ERB ##Slim

gem 'slim-rails'

ex: show.html.slim

h1 = @question.title

p= @question.body

To use text p | View Count: #{@questoin.view_count}

p= @questino.created_at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment