fosdem2011

25
RailsAdmin The right way of doing data administration Bogdan Gaza FOSDEM 2011 FOSDEM 2011 @hurrycane Sunday, February 6, 2011

Upload: bogdan-gaza

Post on 15-Jan-2015

994 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Fosdem2011

RailsAdminThe right way of doing data administration

Bogdan GazaFOSDEM 2011

FOSDEM 2011 @hurrycane

Sunday, February 6, 2011

Page 2: Fosdem2011

@hurrycane

$ whoami

Student at Faculty of Computer Science, Iasi, Romania

Developer at MojoTech

RubySOC 2010 student

@hurrycane

FOSDEM 2011

Sunday, February 6, 2011

Page 3: Fosdem2011

@hurrycane

Data administration is ________*

talking in the context of a web app*FOSDEM 2011

Sunday, February 6, 2011

Page 4: Fosdem2011

@hurrycane

... the way you organize and control your data

FOSDEM 2011

Sunday, February 6, 2011

Page 5: Fosdem2011

@hurrycane

Data administration means the admin panel.

FOSDEM 2011

Sunday, February 6, 2011

Page 6: Fosdem2011

HOW?

@hurrycane

Both simple, secure and fast

FOSDEM 2011

Sunday, February 6, 2011

Page 7: Fosdem2011

Most people write custom admin panels.

@hurrycane

not very simple

definitely NOT fast

prone to errors

FOSDEM 2011

Sunday, February 6, 2011

Page 8: Fosdem2011

Other use CMSs

@hurrycane

simple but not flexible

NOT fastusually secure

FOSDEM 2011

Sunday, February 6, 2011

Page 9: Fosdem2011

The Rails way of doing it is using a plugin engine.

@hurrycane

simplefast

usually secure

FOSDEM 2011

Sunday, February 6, 2011

Page 10: Fosdem2011

@hurrycane

RailsAdminIntroducing

http://github.com/sferik/rails_admin/

FOSDEM 2011

Sunday, February 6, 2011

Page 11: Fosdem2011

@hurrycane

RubySOC 2010 Project

mentorsErik Michaels-Ober,

Yehuda Katz,Rodrigo Rosenfeld Rosas,Luke van der Hoeven and

Rein Henrichs.

FOSDEM 2011

Sunday, February 6, 2011

Page 12: Fosdem2011

Began as Erik’s MerbAdmin and then got ported to Rails 3

@hurrycaneFOSDEM 2011

Sunday, February 6, 2011

Page 13: Fosdem2011

@hurrycane

RailsAdmin is a Rails Engine

FOSDEM 2011

Sunday, February 6, 2011

Page 14: Fosdem2011

@hurrycane

require 'rails_admin/abstract_model'

module RailsAdmin  class ApplicationController < ::ApplicationController

  endend

Basic Enginescontrollers

FOSDEM 2011

Sunday, February 6, 2011

Page 15: Fosdem2011

@hurrycane

Basic Engines

module RailsAdmin  class History < ActiveRecord::Base

  endend

models

FOSDEM 2011

Sunday, February 6, 2011

Page 16: Fosdem2011

Rails.application.routes.draw do

    # Routes for rails_admin controller    controller "main" do      match "/", :to => :index, :as => "dashboard"      match "/:model_name", :to => :list, :as => "list"      ...    endend

@hurrycane

Basic Enginesroutes

For more info checkout the mountable apps RubySOC project.

FOSDEM 2011

Sunday, February 6, 2011

Page 17: Fosdem2011

@hurrycane

RailsAdmin

C Create newR ShowU Easily UpdateD Safely Delete }Your Data

Automatic form validation

Authentication (using Devise)

Use Action History (per row)

Multi-column-search

FOSDEM 2011

Sunday, February 6, 2011

Page 18: Fosdem2011

@hurrycane

RailsAdmin - simple to install

Add in your Gemfile gem 'devise' # Devise must be required before RailsAdmin gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'

Run$ bundle update

$ rails generate rails_admin:install_adminAlso run:

FOSDEM 2011

Sunday, February 6, 2011

Page 19: Fosdem2011

With Rails 3.1 Rails Admin will be mountable. (Thanks

to Piotr!)

@hurrycaneFOSDEM 2011

Sunday, February 6, 2011

Page 20: Fosdem2011

Rails.application.routes.draw do mount Admin::Engine => "/admin"end

@hurrycaneFOSDEM 2011

Sunday, February 6, 2011

Page 21: Fosdem2011

@hurrycane

DEMO

FOSDEM 2011

Sunday, February 6, 2011

Page 22: Fosdem2011

@hurrycane

RailsAdmin 1.0 in a few weeks.

FOSDEM 2011

Sunday, February 6, 2011

Page 23: Fosdem2011

RailsAdmin.config do |config| config.model Team do navigation do visible false end endend

@hurrycaneFOSDEM 2011

RailsAdmin - configuration DSL

Sunday, February 6, 2011

Page 24: Fosdem2011

@hurrycane

QAWhy

Devise? Does it need to

have authentication?

Configuration? Permissions

FOSDEM 2011

Sunday, February 6, 2011

Page 25: Fosdem2011

Thanks!

@hurrycaneFOSDEM 2011

Sunday, February 6, 2011