Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Ajax on registration controller
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
israguy  
View profile  
 More options Oct 31 2012, 11:57 am
From: israguy <guy.isra...@gmail.com>
Date: Wed, 31 Oct 2012 08:57:10 -0700 (PDT)
Local: Wed, Oct 31 2012 11:57 am
Subject: Ajax on registration controller

I'm trying to understand as to why I get

    Template is missing

    Missing template devise/registrations/create, devise/create,
application/create with {:locale=>[:en], :formats=>[:js, :html],
:handlers=>[:erb, :builder, :coffee]}. Searched in: *
"C:/project/app/views" *
"C:/Ruby193/lib/ruby/gems/1.9.1/gems/devise-2.1.2/app/views"

if I try to send the registration information via :remote => true.

As far as I understand, using remote true will ensure that the form is sent
with an ajax post, but once I hit submit I see that the server returns the
missing template error.

I read somewhere that the registration controller is already using
respond_with (I see in the code) which means that it should respond to the
ajax.

Can someone clarify that or if I am missing a piece in the puzzle?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hassan Shahid  
View profile  
 More options Oct 31 2012, 12:03 pm
From: Hassan Shahid <set5th...@gmail.com>
Date: Wed, 31 Oct 2012 12:03:50 -0400
Local: Wed, Oct 31 2012 12:03 pm
Subject: Re: [devise] Ajax on registration controller

it's looking for a create.js.[erb/haml] file under
app/views/devise/registrations/

Because you're asking it to respond to a JS request, it's not going to
render your create.html.[erb/haml] template.

Lastly, a *.js.[erb/haml] is a javascript file that can execute ruby code
using either erb or haml, based on the extension you provide it.

If you don't want to render any template, you need to tell it to render
nothing:

def sample_method
    respond_to do |format|
        format.js { render :nothing => true}
    end
end

- Hassan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
israguy  
View profile  
 More options Oct 31 2012, 4:26 pm
From: israguy <guy.isra...@gmail.com>
Date: Wed, 31 Oct 2012 13:26:29 -0700 (PDT)
Local: Wed, Oct 31 2012 4:26 pm
Subject: Re: [devise] Ajax on registration controller

ah good to know. I thought it should takes it from the assets directory

now I have a different problem.. that the actual create.js.erb is bring
served and not run..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hassan Shahid  
View profile  
 More options Oct 31 2012, 4:33 pm
From: Hassan Shahid <set5th...@gmail.com>
Date: Wed, 31 Oct 2012 16:32:58 -0400
Local: Wed, Oct 31 2012 4:32 pm
Subject: Re: [devise] Ajax on registration controller

some common reasons why your rendered javascript won't run:

- because you may have inconsistencies with single/double-quotes or other
varieties of characters that are being treated differently in the JS from
what you're expecting, you should wrap any html you're rendering via ruby
in the escape_javascript method:

example.js.erb (assuming you're using jQuery):
$('div:first').html('<%= escape_javascript(render :partial =>
"path/to/partial") %>');

- you have a JS error, try copying the response into the browser console
and executing it to see if it runs.

- if all this is not resolving the problem, you may be using some JS
library (an example is jQuery UI Tabs) that overrules rails.js, and is
dictating that it intercepts the ajax call and renders the response.  This
is more complicated to resolve, and there's no one way of solving this, but
it points you in the right direction of what to look for.

-Hassan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
israguy  
View profile  
 More options Oct 31 2012, 4:39 pm
From: israguy <guy.isra...@gmail.com>
Date: Wed, 31 Oct 2012 13:39:51 -0700 (PDT)
Local: Wed, Oct 31 2012 4:39 pm
Subject: Re: [devise] Ajax on registration controller

hmm

I suspect its because of the JS file not being served like an asset

this is the create.js.erb that is placed in /views/devise/registrations as
you suggested

$(document).ready(function() {
return $("#new_todo").bind("ajax:error", function(event, data) {
return alert("Ajax SUCCESS!!!");

});
});

at the load of the page it isn't being served, and only once submitted the
file is being sent back as an ajax response

must the JS file be in the same folder or can I make it so it will run from
somewhere else?

thanks again for your help


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
israguy  
View profile  
 More options Oct 31 2012, 4:42 pm
From: israguy <guy.isra...@gmail.com>
Date: Wed, 31 Oct 2012 13:42:20 -0700 (PDT)
Local: Wed, Oct 31 2012 4:42 pm
Subject: Re: [devise] Ajax on registration controller

the js seems to work if I put it in the home.js.erb (for pages#home)
and bind it to a div there

you still helped very much!

free hugs!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
israguy  
View profile  
 More options Oct 31 2012, 4:59 pm
From: israguy <guy.isra...@gmail.com>
Date: Wed, 31 Oct 2012 13:59:51 -0700 (PDT)
Local: Wed, Oct 31 2012 4:59 pm
Subject: Re: [devise] Ajax on registration controller

but the create.js.erb it still being served.. so no good.

if the file is not there it complains about missing template

if the file is there it just serves it..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
israguy  
View profile  
 More options Oct 31 2012, 5:09 pm
From: israguy <guy.isra...@gmail.com>
Date: Wed, 31 Oct 2012 14:09:46 -0700 (PDT)
Local: Wed, Oct 31 2012 5:09 pm
Subject: Re: [devise] Ajax on registration controller

ah got it..

the create.js.erb shouldn't be a complete js file

it should only be the commands to be run!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »