No commit activity in last 3 years
No release in over 3 years
ryanb's nifty-generators + i18n, blueprint, formtastic, declarative_authorization and cancan.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Splendeo Generators¶ ↑

A collection of useful Rails generator scripts for scaffolding, layout files, authentication, and more.

This is a fork from Ryanb’s nifty_generators (github.com/ryanb/nifty-generators). It extends it with the following features:

  • Everything is translatable in a i18n-compliant way

  • formtastic is used for forms

  • blueprintcss is included by default

  • The scaffold generator supports declarative_authorization and cancan

Install¶ ↑

gem install splendeo-generators

Usage¶ ↑

Once you install the gem, the generators will be available to all Rails applications on your system. If you run script/generate without any additional arguments you should see the available generators listed.

To run the generator, go to your rails project directory and call it using the script/generate or script/destroy command.

script/generate splendeo_scaffold Recipe name:string index new

Included Generators¶ ↑

  • splendeo_layout: generates generic layout, stylesheet, and helper files.

  • splendeo_scaffold: generates a controller and optional model/migration.

  • splendeo_config: generates a config YAML file and loader.

  • splendeo_authentication: generates user model with sign up and log in.

To view the README for each generator, run it with the --help option.

script/generate splendeo_layout --help

Troubleshooting and FAQs¶ ↑

What is the difference between splendeo_scaffold and built-in scaffold?

One of the primary differences is that splendeo_scaffold allows you to choose which controller actions to generate.

script/generate splendeo_scaffold post name:string index new edit

There are a few changes to the generated code as well, such as no XML format by default.

It also offers support for HAML, Shoulda, and RSpec.

i18n + formtastic support make translations much easier.

Finally, blueprintcss is installed by default.

I get “undefined method ‘title’” error.

Try running splendeo_layout, that will generate this helper method. Or you can just change the templates to whatever approach you prefer for setting the title.

I can’t set new attributes in my model.

Add the attribute to the attr_accessible line in the model.

I get “undefined method ‘root_url’” error.

Some generators default redirecting to the root_url. Set this in your routes.rb file like this (substituting your controller name).

map.root :controller => 'foo'

I get a missing database error.

Run rake db:migrate.

I get a routing error when I try to submit a form.

Try restarting your development server. Sometimes it doesn’t detect the change in the routing.

The tests/specs don’t work.

Make sure you have mocha installed and require it in your spec/test helper.

gem install mocha

# in spec_helper.rb
config.mock_with :mocha

# in test_helper.rb
require 'mocha'

Also, make sure you’re using Rails 2.1 or greater.

Found a bug?¶ ↑

If you are having a problem with Splendeo Generators, first look at the FAQs above. If you still cannot resolve it, please submit an issue here.

github.com/splendeo/splendeo-generators/issues

Rails 3¶ ↑

Splendeo Generators does not work with Rails 3.