Rails application generator and scaffold templates
Stationed is an extensive Rails application generator, providing you with a
starter app full standard goodies such as testing, authentication,
authorization, decorators, tasks and styles. But as an engine it also provides
you with customized scaffold generators including proper tests. Finally, it
provides some basic view helpers that every project tends to need. All in all,
stationed is pretty sweet.
In order to use Stationed to generate applications, install the gem:
% gem install stationed
To use it as an engine in your Rails application, include it in your Gemfile:
gem 'stationed'
Run bundle install
and you’re all set.
The application generator is invoked using the stationed
command:
% stationed my_app
This will generate a default Rails application with the following additions:
…and some other minor configurations and goodies.
All these additions are stand-alone “plugins” for the base application
generator, so it is easy to adapt them or add others. Plugins have their own CLI
options, so you can easily enable or disable them. To see the available options,
run:
% stationed -h
The page title helper allows you to set a page title based on a string,
translation key or by a resource. You can easily output it on your page and in
your layout.
You can provide templates for page titles using I18n
in three broad
categories: the model
, formatted
and standard
keys. These will be used
when you set a page title via a model, string or nothing at all, respectively.
You can specify these translation keys on a global default level, per controller
or per controller action. The more specific key will take precedence.
A collection of helper methods to generate links to CRUD operations with labels
and URLs generated by resources.
For example:
link_to_new(Post) # => <a href="/posts/new">New Post</a>
link_to_edit(@product) # => <a href="/products/1/edit">Edit Product 1</a>
You can use I18n to fully customize the labels on these links. There are helper
methods for new
, edit
, show
, destroy
and index
, in the variants
link_to
, button_to
and button_link_to
(for links with a button
class
name).
Display a placeholder message using standardized markup and a message defined
through I18n.
When in a controller PostsController and action index, this will try to look up
the following placeholder keys:
You can also provide an argument to set the placeholder message. When given a
string, it will be used directly as the placeholder message. When given a
symbol, that key will be looked up in the placeholders.defaults
namespace
using I18n.
For example:
placeholder('Nothing found') # => '<p class="placeholder">Nothing found</p>'
Stationed includes customized scaffold templates for Haml, Rspec and
controllers. These work out of the box, but you can use a generator to install
the templates into your application for easy customization:
rails generate stationed:templates
Please report any issues, defects or suggestions in the Github issue
tracker.
See the HISTORY file for a detailed changelog.
Created by: Arjan van der Gaag
URL: http://arjanvandergaag.nl
Project homepage:
http://avdgaag.github.com/stationed
Date: april 2014
License: MIT-license (same as Ruby)