Maintenance Release Version 0.0.4

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.

4 Responses to “Maintenance Release Version 0.0.4”


  1. 1 Evan

    I had some issues getting the yaml form definition file to load correctly. I kept getting a runtime error: “Form configuration file smerf/testsmerf.yml not found.” At the same time the WEBrick server was responding with an error 500 (internal server error).

    I traced the error back to app/models/smerf_file.rb, and tried the http get request in the rails console:

    /My/Rails/Project/# ./script/console
    Loading development environment (Rails 2.0.2)
    >> SmerfForm.smerf_user_id = 1
    => 1
    >> app.get ’smerf_forms/testsmerf’
    => 200

    It returned http server status 200, so everything was working as expected.

    Thinking that it was likely related to the relative path of the testsmerf.yml config file, I made the path to the file absolute instead of relative where the SmerfFile.smerf_file_name() method generates the file name and path. After a couple of other changes to reflect the new absolute path, problem solved.

    Although it was possibly the configuration of my ROR devel environment, here are the changes that I made to get smerf to work correctly.

    Here are the changes to I made to RAILS_ROOT/vendor/plugins/smerf/app/models/smerf_file.rb:

    changed line 104 from:
    raw_data = YAML::load(File.open(”#{RAILS_ROOT}/#{@smerf_file_name}” ))
    to:
    raw_data = YAML::load(File.open(@smerf_file_name))

    changed line 191 from:
    return self.smerf_file_name(code)
    to:
    return filename

    changed line 198 from:
    “smerf/#{code}.yml”
    to:
    “#{RAILS_ROOT}/smerf/#{code}.yml”

    Hope this helps anyone else out there having similar problems. YMMV.

  2. 2 etienne

    Hi Evan,

    Thanks for taking the time to post your solution to your problem. I will have a look at the code and see if I can’t incorporate your changes in the next release.

  3. 3 Tom Harrison

    I am having trouble figuring out how to associate a survey with an actual user. I removed the setting in application.rb (SmerfForm.smerf_user_id = 1), which was presumably for testing. I have a method “current_user” that I can query to get the id … but how do I tell Smerf to use that?

    I tried setting the value in SmerfForm.smerf_user_id prior to making the call to load the form, but that didn’t work, and it can’t be the right way (what if two users are answering the survey at the same time). Yet I see that it is this value being used when the survey is saved in the create method. This seems like something that would need to be set in the session, or perhaps in a hidden form field rather than a class variable which is global (I believe) to all instances of the class.

    Anyway, I am undoubtedly just confused. Any help would be greatly appreciated.

    Regards,

    Tom

  4. 4 etienne

    Hi Tom,

    To tell SMERF about the current user you would do something like this once your user have been authenticated:

    SmerfForm.smerf_user_id = current_user

    When you say it does not work, do you mean SMERF is not saving the record with the correct user id?

Leave a Reply