• This repository has been archived on 07/Jun/2018
  • Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 16 years ago
  • Updated about 15 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rails scaffold generator that outputs Haml and better functional tests.

Haml Scaffold¶ ↑

A collection of hacks to the Rails scaffold generator, to make it output templates using Haml rather than ERB. You may like some of it, and may hate other parts. You’re free to use it under the terms of the MIT license if the parts you like outweigh the parts you hate.

This scaffold generator does the same thing as the default Rails scaffold generator, with a few differences.

Differences from Rails Scaffolding:¶ ↑

  • Haml not ERB.

Controller¶ ↑

  • Loads object with a before_filter to be DRYer.

  • “Destroy” method handles error conditions.

  • Actions are alphabetized for more obvious consistency.

  • Uses will_paginate.

Controller Test¶ ↑

  • Tests error conditions, not just the “happy path.”

  • Has 100% code coverage with RCov.

  • Uses very simple mocking with mocha to limit calls to the DB.

Views¶ ↑

  • Have cleaner, more semantic XHTML that’s easier to quickly replace with your own markup.

  • Are broken up into a couple of partials to be DRYer.

  • Use will_paginate.

Misc¶ ↑

  • Generates Haml layout and SASS stylesheet.

Samples¶ ↑

View them here.

Installation¶ ↑

Haml Scaffold is available on RubyForge as a gem:

sudo gem install haml_scaffold

You can also install it as a Rails plugin if you wish:

./script/plugin install git://github.com/norman/haml-scaffold.git

Dependencies¶ ↑

The generated code will depend on:

You’ll need to add the gem dependencies to your config/environment.rb manually:

config.gem "haml"
config.gem "will_paginate"
config.gem "mocha"

Also, don’t forget to Hamlize your Rails app:

$ cd my_rails_app
$ haml --rails .

Other stuff you might be interested in:¶ ↑

Author¶ ↑

Norman Clarke

This work is derived from code in Ruby on Rails and is released under its same license, the MIT License.

More Repositories

1

friendly_id

FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
Ruby
6,129
star
2

babosa

A library for creating slugs. Babosa is an extraction and improvement of the string code from FriendlyId, intended to help developers create similar libraries or plugins.
Ruby
529
star
3

disqus

A Ruby library for the Disqus commenting API and Javascript widgets.
Ruby
250
star
4

telescope

A highly customizable test library for Lua that allows declarative tests with nested contexts.
Lua
159
star
5

squirm_rails

Easily use and manage Postgres stored procedures with Active Record.
Ruby
72
star
6

friendly_id-globalize

Globalize support for FriendlyId
Ruby
66
star
7

ambry

Ambry is a database and ORM replacement for (mostly) static models and small datasets. It provides ActiveModel compatibility, and flexible searching and storage.
Ruby
56
star
8

lua-haml

Haml for Lua
Lua
53
star
9

hello-lua

A demo of how to make simple C modules for Lua
C
34
star
10

squirm

A library that simplifies working with Postgres stored procedures.
Ruby
18
star
11

grackle

A static blog generator written in Lua
Lua
18
star
12

luacov

LuaCov is a simple coverage analyzer for Lua code. (fork of official CVS repo)
16
star
13

lua-postgres

A basic Postgres driver for Lua
C
16
star
14

has_image

A lightweight and hackable library for attaching images to ActiveRecord models.
Ruby
16
star
15

phonenumber

Allows parsing and formatting of phone numbers
Ruby
16
star
16

hops

A lightweight, pluggable web framework for Lua
Lua
15
star
17

lua-devtools

An irb-workalike for Lua, and a command-line debugger with readline support.
Lua
15
star
18

tlua

A simple task runner for Lua - now abandoned because I think it's just easier to use plain old Makefiles.
Lua
14
star
19

spanish

Linguistic utilities for working with Spanish words.
Ruby
12
star
20

enc

Notes and slides from my Encodings talk at RubyConf Brasil 2010
Ruby
12
star
21

nearby

Quick and easy geocoding using Geonames.org data and TokyoCabinet.
Ruby
10
star
22

nt54

Argentine phone number parsing, validating, formatting and meta-info
Ruby
10
star
23

active_record_random

Monkey patch to ActiveRecord to allow :order => :random that works the same for MySQL, SQLite and Postgres.
9
star
24

fatalistic

Table locking for Active Record
Ruby
9
star
25

yourbugreportneedsmore.info

The yourbugreportneedsmore.info website
HTML
8
star
26

friendly_id_manual_slug_demo

A Rails 3 app showing how to manually control FriendlyId slugs
Ruby
7
star
27

mongrel2_wsapi

In-progress Lua WSAPI adapter for Mongrel2
Lua
6
star
28

base-site-generator

The current base layout and helpers I'm using to scaffold quick projects. Feel free to use if and as you wish.
Ruby
6
star
29

squirm_model

Model API for Squirm
Ruby
5
star
30

micro_factory

Minimal factories for Active Record.
Ruby
4
star
31

utf8_utils

Utilities for cleaning up UTF8 strings.
Ruby
4
star
32

phonology

Phonology utilities for Ruby
Ruby
3
star
33

dotfiles

My dotfiles
Vim Script
2
star
34

wsapi_test

Mock connector for unit testing WSAPI apps. TEMP. Go here instead: http://github.com/norman/wsapi
Lua
2
star
35

hash_formatter

Hash Formatter is a library that formats Ruby hashes for code editors.
Ruby
2
star
36

gem_init

My Ruby Gem initialization biolerplate
Ruby
2
star
37

luaargentina

luaargentina.org website
2
star
38

luadns-zones

My DNS zones hosted on LuaDNS.
Lua
1
star
39

friendly_id_join_test

Temporary debugging repo, don't follow
Ruby
1
star
40

haml_textarea_bug

Demonstrates a bug in Haml
Ruby
1
star
41

vim-files

My vim files
Vim Script
1
star
42

friendly_id_sequel

An adapter which allows you to use FriendlyId with Sequel::Model
Ruby
1
star