Survey Rails 4 engine
Add to Gemfile and bundle :
gem 'surveillance', github: 'vala/surveillance'
Execute install generator :
rails generate surveillance:install
- Configure with generated initializer
- Access admin at :
/<mount_path>/admin/surveys
- Access surveys at :
/<mount_path>/surveys
- Require the javascript lib in your application.js :
//= require surveillance
If you need to override a class from the system, e.g. adding a validation or
method to a model, a before_action
to a controller or something like that,
you can use the "decorators" approach the following way :
- Create a file with the name of the desired class under
lib/decorators/surveillance/
, e.g.lib/decorators/surveillance/attempt.rb
- Use
.class_eval
to reopen the class and modify it. e.g.
# lib/decorators/surveillance/attempt.rb
Surveillance::Attemp.class_eval do
def foo
puts 'bar'
end
end