jeffp / wizardly
- Source
- Commits
- Network (7)
- Issues (9)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
-
ActionController::MethodNotAllowed: Only get and post requests are allowed.
3 comments Created 3 months ago by morganchristianssonMy app fails in the guard_entry method where ::ActionController::Routing::Routes.recognize_path(path) statement is run, regardless of :guard option to act_as_wizard.
def guard_entry if (r = request.env['HTTP_REFERER']) h = ::ActionController::Routing::Routes.recognize_path(URI.parse(r).path) return check_progression if (h[:controller]||'') == '#{self.controller_name}' self.initial_referer = h unless self.initial_referer endHere is a reproducible snippet:
>> ::ActionController::Routing::Routes.recognize_path("/packages", {}) ActionController::MethodNotAllowed: Only get and post requests are allowed. from /home/mog/work/kistamassan/vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisation.rb:64:in `recognize_path' from (irb):14However if i pass in :method => :get option it works fine.
>> ::ActionController::Routing::Routes.recognize_path("/packages", {:method => :get}) => {:action=>"index", :controller=>"packages"}This happens for routes that have :conditions => { :method => :get } defined and includes all routes defined by map.resources. If the request comes from one of these URLs this error will happen.
Comments
-
How can I edit an existing resource on a specific stage?
1 comment Created 2 months ago by rubenfonsecaHi! Thanks for your plugin.
How can I edit an existing resource on a specific stage? Imagine I have the stages :stage1, :stage2, :stage3. I fill all the stages and the object is created. I then want to re-edit on :stage2. Is it possible?
Comments
Easiest is to create a :stage4, and save the model instance in :stage3:
on_next(:stage3) do @model_name.save endOtherwise, you'll have to set up some routing. Try the following.
on_finish(:stage3) do do_not_complete @model_name.finished = true @model_name.save #or save_without_validation redirect_to :stage2 end on_next(:stage2) do if @model_name.finished complete_wizard(your_redirect_here) end endIn this method, you'll have to add a field to detect that :stage3 has been completed, I called it 'finished' and used a boolean defaulting to false. The 'do_not_complete' method tells the wizard to maintain its knowledge of the current model when the user presses finish, this allows you to re-enter :stage2 and work on the same model instance. We call 'complete_wizard' here if this is the second time through.
Let me know what works.
-
I'm using authlogic for my authentication plugin and have a three step wizard setup that sets up a a user that is acting as authentic with authlogic doing stuff behind the scenes like encrypting passwords, etc.
When the final step is completed and the FINISH button is pressed the User object is written to the database but it looks like authlogic hasn't had a chance to do it's stuff as various fields it populates are nil. The result is this error:
Mysql::Error: Column 'crypted_password' cannot be null: INSERT INTO 'users'The bottom of the code stack looks like this:
(eval):52:in 'complete_wizard' (eval):110:in 'step3'After a lot of digging the crypted_password field is not being set as I've protected it in my model to prevent people setting up users using a URL (see http://b.lesseverything.com/2008/3/11/use-attr_protected-or-we-will-hack-you ).
Wizardly uses mass assignment to submit my final record and this conflicts with using attr_protected on some important user attributes. Can anyone recommend a work round so I can use wizardly, authlogic and attr_protected? I'm thinking - maybe a callback method that I can use in place of mass assignment so I can poke in the values into a new User object myself?
Comments
-
Error in db:migrate on a fresh database when using act_wizardly_for
0 comments Created 2 months ago by matellisI'm using the Lockdown gem with my app. When I drop, create & migrate my database I get this error:
/project/vendor/gems/wizardly-0.1.8.9/lib/wizardly/wizard/configuration.rb:67:in `create': Cannot convert :user to model constant for User: Mysql::Error: Table 'project_dev.users' doesn't exist: SHOW FIELDS FROM `users`It's a chicken and egg: the class can't load because there is no User table and there will be no User table until I've ran db:migrate. Commenting out the act_wizardly_for allows me to migrate.
I've seen this before with eager_class_loading but this was fixed in Rails 2.3. (I'm running Rails 2.3.4 and Ruby 1.8.7.)
I fixed it with a nasty hack that disables Lockdown when I'm running db:migrate but I'm pretty sure this will bite me some other way in the future.
I posted an example here http://github.com/matellis/wizardly-examples and filed a bug with Lockdown here http://stonean.lighthouseapp.com/projects/33317/tickets/35
Comments
-
Inline errors don't work with justinfrench_formtastic when using the form.inputs or form.errors_on methods. Stepping through a trace it looks as if the regular form helper is called when there is an error. The piece of the code in formtastic that handles the input method is never ran. You can show this by making your form a partial with 1 step in wizardly. When the partial is shown outside of wizardly the inline errors are displayed, but inside wizardly they are not. The errors object is just fine, if you add it to the top of the form you will see any validation errors.
Comments
Dumb dumb dumb. Wizardly demo app refers to forms like this:
<% form_for :user_signup, :url=>{:action=>:account} do |f| %>Which works great for form_helper, but not for formtastic. Formtastic passes through anything it doesn't understand to form_helper, so the form doesn't break but any Formtastic features are quietly turned off.
Rename your object as below and everything works nicely:
<% form_for @user_signup, :url=>{:action=>:account} do |f| %>Not really a wizardly problem. At least this might save some other noob a few hours.
-
I've been trying to use nested attributes and wizardly, but I'm getting some strange type mismatch errors. Seems like saving nested attributes is not quite working when used under wizardly.
Is it me, or has this been tested and is deemed supported by wizardly?
Thanks!
Comments
-
Problem with wizards containing has_many :through relationships
0 comments Created about 1 month ago by aberiosIf I have a Question model, for example, with a has_many :answers, :through => :question_answers relationship, and create a wizard with a step allowing a user to check the answers, the wizard retains the associated models when :persist_model is set to :per_page, but if :persist_model is set to :once, the associated answers are not retained. Any way around this?
Comments
-
How to access params passed in parameters just before call step1 of a wizard
0 comments Created about 1 month ago by jeromelefeuvreHi,
I passed params just before call the wizard. How to access ?
thanks
JeromeComments
-
I have a wizard that was working as desired however when I tried to integrate LipsiAdmin and move everything to the front end section of it, it will only render step 1. When I end up clicking on "next", it stores the result in the database and displays step 1 again. Does anyone have any suggestions on how to fix this?
Comments





Commited fix in http://github.com/morganchristiansson/wizardly/commit/c614305e8a92d263e7a827f9fef8a0518eea226f
Let me know if you think this is correct.
Regards,
Morgan
Thanks Morgan. Looked into the problem. I believe your solution suffices except for the situation where a request comes from a resource without an available GET method. But I think this is rectified by wrapping as such
begin
h = ::ActionController::Routing::Routes.recognize_path(URI.parse(r).path, {:method=>:get}) rescue
else
return check_progression if (h[:controller]||'') == '#{self.controller_path}' self.initial_referer = h unless self.initial_referer end
I've tested and regemed. If this works for you, I'll close this issue.
Regards,
Jeff
sorry, code was not very readable... try this