memonic

Casein - A lightweight Ruby on Rails CMS

Save

Casein is an open source CMS for Ruby on Rails, originally developed by Spoiled Milk.

It provides scaffolding generators and helper functions to quickly create a lightweight CRUD interface for your data, along with a pre-rolled user authentication system.

Casein is designed to be completely decoupled from the front-end. Therefore it may be added to new or existing Rails projects, or even used as a standalone CMS to drive platforms built on other technologies.

→ Casein on GitHub

(Download or fork the source, and browse documentation)

Features

  • Quick start

    Generate a modern and minimal CRUD interface for your data using the supplied Rails generators.

  • Powerful customisation

    The generated views and controller logic can be infinitely customised as required. Casein comes with a range of helper functions to get you started.

  • User management

    User authentication and basic management to support developers and clients is pre-rolled and ready to go.

Get involved


While the central mission of Casein is to provide developers with a basic CMS platform and the freedom to customise as required, we do have ideas of future features that may find their way into the project core.

If you're using Casein and are working to add additional functionality then let us know.

In the meantime, this is our current roadmap:


  • Media uploader/picker widget
  • Active scaffolding version
  • Content versioning
  • Native support for has_many relationships
  • Full namespacing of the controllers
  • Built-in support for list sorting
  • Slugs—human-readable URLs

Built with Casein

Here are some example websites and applications running on Casein. Do you have a project built with Casein? Let us know and we will add it to the list.

Implementing Iterators

Save
Implementing Iterators
A Ruby iterator is simply a method that can invoke a block of code. At first sight, a block in Ruby looks just like a block in C, Java, or Perl. Unfortunately, in this case looks are deceiving---a Ruby block is a way of grouping statements, but not in the conventional way. First, a block may appear only in the source adjacent to a method call; the block is written starting on the same line as the method's last parameter. Second, the code in the block is not executed at the time it is encountered. Instead, Ruby remembers the context in which the block appears (the local variables, the current object, and so on), and then enters the method. This is where the magic starts. Within the method, the block may be invoked, almost as if it were a method itself, using the yield statement. Whenever a yieldis executed, it invokes the code in the block. When the block exits, control picks back up immediately after the yield.[Programming-language buffs will be pleased to know that the keyword yield was chosen to echo the yield function in Liskov's language CLU, a language that is over 20 years old and yet contains features that still haven't been widely exploited by the CLU-less.] Let's start with a trivial example.
def threeTimes
  yield
  yield
  yield
end
threeTimes { puts "Hello" }
produces:
Hello
Hello
Hello
The block (the code between the braces) is associated with the call to the method threeTimes. Within this method, yield is called three times in a row. Each time, it invokes the code in the block, and a cheery greeting is printed. What makes blocks interesting, however, is that you can pass parameters to them and receive values back from them.