Simple MEta Rails Form (SMERF)

SMERF is a Ruby on Rails plugin that allows you to easily create dynamic forms which you can use for surveys, questionnaires, data collection and other forms. It records which forms a user have completed and saves the users responses so that they can easily be analysed via SQL. Currently forms are defined using YAML files.


  • You need to have a table that stores details about the users of your application. SMERF will keep track of the forms a user completes as well as the users responses to questions on these forms.
  • The name of this users table as well as the primary key and model needs to conform to the Rails convention, i.e.
    - DB table name needs to be plural, e.g. users
    - Primary key assumed to be named id
    - Model name is singular of the DB table, e.g. user
  • SMERF is a RESTful plugin
  • It has only been tested with Rails V2


The plugin is easy to install, once you have downloaded the source code run the following command from the root directory of your Rails application 

./script/generate smerf usermodelname

 Replace usermodelname with the model you use for storing details about your applications users, for example

./script/generate smerf user

Please note the model name needs to be specified in lowercase.


  1. Run the DB migration  
    rake db:migrate
  2. Include the Smerf module in the controller where it will be used, if you want all controllers to have access add it to the application.rb, e.g.
    include Smerf
  3. Set the record ID of the current user so that SMERF can save responses for each user. This can normally be done once the user has been authenticated by using the following code as an example:
    self.smerf_user_id =
  4. You can use the example stylesheet(smerf.css) supplied with the plugin which was copied to the /public/stylesheets directory by adding it to your application layout, e.g.
    <!--stylesheet_link_tag "smerf", :cache => true-->
  5. To create a link to display a form you can use the Standard REST Path method used for the show action passing the name of the form definition file as a parameter, for example
    link_to('Complete Test Smerf Form', smerf_url('testsmerf'))

Testing your installation

To test the installation you can display the test form that comes with SMERF when you install it. Everything will work as is as long as you have an existing user record with id = 1. If not you need to modify the smerf_test_cotroller.rb file found in vendor/plugins/smerf/app/controllers. Simply change the line

self.smerf_user_id = 1

and set smerf_user_id to an existing user record id.

Display the SMERF test form by doing something similar to this



SMERF is Copyright(c) 2008 Etienne van Tonder, Cascadia Software Pty Ltd, released under the MIT license


Please Consider

  1. If you find this plugin useful it would be greatly appreciated if you could recommend me at Working With Rails. I’m a freelance developer and would value your recommendations.

    Recommend Me

  2. That you consider freely sharing any changes that you make to the plugin. Also that you share any new functionality that you creare for use with the plugin that you consider may be useful to other users.