Skip to content

matellis/wizardly-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplified wizardly-examples illustrating issue with lockdown

Issue affecting how lockdown interacts with stuff like wizardly

Wizardly can be found here github.com/jeffp/wizardly

Lockdown can be found here stonean.com/page/lockdown

Setup

clone the directory

git clone git://github.com/matellis/wizardly-examples.git

change to the directory and build the database. The examples currently use Sqlite3 (you’ll need it installed or change the database to your preference)

rake db:create
rake db:migrate

start the server

./script/server

Simplification

All the examples from the original code have been removed except for simple sign up. This is to make the code a little shorter.

All the relevant gems were added to the vendor folder in case one of them was the problem.

The Issue

Go to the folder config/initializers/lockit.rb and uncomment the first and last lines. This will make Lockdown run whenever you run db:migrate. Now go and rebuild the database:

rake db:drop
rake db:create
rake db:migrate

You will get an error message a bit like this:

/code/wizardly-examples(master) >rake db:drop;rake db:create; rake db:migrate
(in /code/wizardly-examples)
(in /code/wizardly-examples)
(in /code/wizardly-examples)
=> Mixing in Lockdown version: 1.3.1 
=> Requiring Lockdown rules engine: /code/wizardly-examples/lib/lockdown/init.rb 
rake aborted!
/code/wizardly-examples/vendor/gems/jeffp-wizardly-0.1.8.8/lib/wizardly/wizard/configuration.rb:67:in `create': Failed to configure wizard from UserSignup validation groups: Could not find table 'users'
(See full trace by running task with --trace)

This is the chicken and egg: Lockdown is attempting to load the UserSignup model which relies on the Users table which isn’t there yet as we haven’t ran db:migrate yet.

I hacked a fix by only loading the lockdown code if db:migrate is not running. This causes a couple of errors but does seem to fix the issue.

About

Examples for the jeffp-wizardly gem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.4%
  • JavaScript 0.6%