A Project has_many revisions.  I'm in the process of updating and rewriting 
a rails 2.3 app to a rails 3.1 app.

Revisions is an embedded AS in the Project Edit form.  It displays 
correctly inline.  Opening Create or Update forms correctly gets them from 
the server.  But when I edit an existing entry, or I create a new entry in 
the revisions table that's part of that form, It does the appropriate 
create/update action and then reloads the whole page to the revisions 
controller.  

The embedded scaffolds work correctly in my original app, but are not 
working correctly in the new one, and I don't know why.  I have rails 
3.1.3, ActiveScaffold 3.1.13, CanCan 1.6.7

the form html looks like
<form accept-charset="UTF-8" 
action="/revisions?eid=25e6fec8578a1585ca609cb9fd0c7564" class="as_form 
create" data-loading="true" data-remote="true" 
id="as_25e6fec8578a1585ca609cb9fd0c7564-create--form" method="post"><div 
style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" 
value="✓"><input name="authenticity_token" type="hidden" 
value="6ciqb988kB6GlkGCvjBy6I4mrP8qoMf643PH+gMTzcw="></div>


For an edit, the server receives a request like...
Started PUT "/revisions/336?eid=25e6fec8578a1585ca609cb9fd0c7564" for 
127.0.0.1 at 2011-12-27 14:44:21 -0700

Includes a standard(as far as I can tell) parameter set
[2011-12-27 14:44:21] INFO  ActionController::Base :   Parameters: 
{"utf8"=>"✓", 
"authenticity_token"=>"6ciqb988kB6GlkGCvjBy6I4mrP8qoMf643PH+gMTzcw=", 
"record"=>{"revision_date"=>"2011-12-22", "revised_amount"=>"100.0", 
"optional_amount"=>"10.0", "notes"=>"Test"}, "commit"=>"Update", 
"eid"=>"25e6fec8578a1585ca609cb9fd0c7564", "id"=>"336"}

Then reports (After the Active Record updates)
[2011-12-27 14:44:21] INFO  ActionController::Base : Redirected to 
http://0.0.0.0:3000/revisions?eid=25e6fec8578a1585ca609cb9fd0c7564

and
Started GET "/revisions?eid=25e6fec8578a1585ca609cb9fd0c7564" for 127.0.0.1 
at 2011-12-27 14:44:22 -0700

So I think one of two things is happening.
1.  The Update form is not getting properly setup to do an all javascript 
submit/return cycle.
2.  The Create action is returning HTML instead of JSON or doing a redirect 
for some other reason.

But I don't know what to look for next to help troubleshoot this, and I 
have 6 more scaffolds to embed on this form.   I have tried a second 
scaffold (addendums) and have the same behavior for that one.

I've attached the revisions_controller file and the revision model.

I'm rendering the forms in HAML as
      = render active_scaffold: "revisions", constraints: {project_id: 
@project.id}


Thanks for any insights you might provide.

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/activescaffold/-/2nSznC42_bwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Attachment: revisions_controller.rb
Description: Binary data

Attachment: revision.rb
Description: Binary data

Reply via email to