There have been a couple of people using Rails 2.1 and above that have reported the following error:
Status: 500 Internal Server Error
Unprocessed view path found: "…/vendor/plugins/smerf/app/views". Set your view paths with #append_view_path, #prepend_view_path, or #view_paths=
It appears that making changes directly to the view_paths array has been deprecated and #append_view_path or #prepend_view_path should be used instead. I will shortly release a new version to address this problem but in the mean time you can fix this problem by modifying the smerf_init.rb file in /vendor/plugins/smerf:
ActionController::Base.view_paths << file_path if file_path.include?(’views’)
to
ActionController::Base.append_view_path file_path if file_path.include?(’views’)
I am pleased to announce a major update to SMERF to V0.1.0, there has been some significant code changes to overcome a number of problems. I would recommend that everyone upgrade to the new version as soon as possible.
Changes
Most of the problems relate to the use of class variables in the old version, the code has been completely rewritten to remove ALL class variables. The two main issues caused by the use of the class variables where:
- The validations used for a form would be determined by the form that was loaded first, these validations would be used for all subsequent forms as the validations for the form was stored in a class variable and never replaced. This is only a problem if you have more than one form defined. Thanks to Alexander Lang for reporting this problem.
- If you have more than one user accessing the system at the same time the results will be stored against the user that last logged into the system. Again this was caused by the id of the user record being stored in a class variable. Thanks to Christopher Souvey for reporting this problem.
Other changes in this release include:
- Modify generator to convert model name to lowercase
- Fix minor bug in smerf_forms_user template, additional ’s’ was being added to a variable name
- Include smerf_responses.rb in generated files as content on file depends on specified user model
How to Upgrade
Follow the following steps to upgrade an existing installation:
1. * Backup your current files
2. Generate SMERF again using:
ruby script/generate smerf usermodelname
You may need to delete the db migration file for it to run. There has been no DB changes so there is no need to do a migration.
3. Include the Smerf module in the controller where you are accessing smerf_user_id, if you want it to be available to all controllers include the module in application.rb, i.e.
4. You will need to change the code that you use to assign the user record id to SMERF:
Old:
1
| SmerfForm.smerf_user_id = ... |
New:
1
| self.smerf_user_id = ... |
4. Touch or change all your SMERF form definition files to force SMERF to re-process them.
5. Test to make sure everything is working as expected.
Please Note:
- I have only tested this with Rails V2.0
- I have not yet written any tests for the plugin so please report any problems you experience.
- Use at your own risk.
Thanks to Alan Masterson for finding and reporting a bug in the way responses where being handled when using the new selectionbox question type field, release Version 0.0.4 addresses this bug.
To update your system you will need to:
- Download and install the new version
- Generate the plugin again as one of the template files have been updated. You will need to delete the migration file before doing this otherwise the generate will not work, the migration has not changed so you will not need to rerun it again.
- Test your application to make sure everything still works as expected.
Enhancements
- Add new selectionbox question type.
- Add selectionbox_multiselect question option.
- Update RDoc with new question type details.
I’ve added a new question type using the select field type as requested by Alan Masterson. You can check out the Usage page for more details. You can use this new type by setting the question type to selectionbox. This will display all your answers as a drop down list of options from which the user can select a single answer.

A new field selectionbox_multiplechoice can be set for a select type question that allows the user to select multiple answers.

I’ve updated the testsmerf.yml file to include examples of the new question type. You can get this file from the vendor/plugins/smerf/generators/smerf/templates/smerf directory or you can run the smerf generator again for it to install the new version. You will need to delete the previous migration file for the generator to run.
Other changes
Allow installation via the Rails plugin installer for information check out the Download page, you can now install the plugin using
ruby script/plugin install http://smerf.rubyforge.org/svn/stable/smerf
I’ve cleaned up the templates directory by removing all non-template files, this has allowed me to simplify the generator quite a bit.
I am happy to announce the very first release of SMERF (Simple MEta Rails Form). SMERF is a Ruby on Rails plugin that allows you to very easily create dynamic forms using a form definition file. You can quickly and easily create surveys, questionnaires, data collection or any other type of form.
It saves the user responses to a DB table which the user can then retrieve and modify at any time. Responses to each question on a form is also recorded in the DB allowing you to perform analysis of the responses via SQL queries. Check out the About and Usage pages for more information. If you have any problems, questions or suggestions please feel free to contact me at smerf at cascadia dot com dot au.
Enjoy!
Latest Comments
RSS