1

I created app according to this post http://stjhimy.com/posts/7-creating-a-100-ajax-crud-using-rails-3-and-unobtrusive-javascript , but get an error:

Missing template posts/create, application/create with {:handlers=>[:erb, :builder, :coffee, :haml], :formats=>[:html], :locale=>[:en, :en]}. Searched in: * "/home/ember/Projects/test_app/app/views"

Maybe in Rails 3.1 actions render something by default. Besides, there no format js (:formats=>[:html]). But i can`t find any about this.

When i doing like this:

  respond_to do |format|
    format.js {render :content_type => 'text/javascript'}
  end

or without content_type - browser redirects to empty page. In this case:

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

browser shows the same empty page. How can i do that without any redirects?

Maybe it`s old method?

2
  • Can you post the code of the view that is submitting the form, so we can see how you're calling posts/create? Commented Aug 18, 2011 at 13:13
  • 1
    Oh, the problem was with rails.js file that i added, it's not working correctly. Now it works file, when i deleted it. Sorry, that i didn't mention this. So, the problem is solved, maybe i need to mark this somehow? Commented Aug 19, 2011 at 3:35

2 Answers 2

3

Try adding the jquery-rails gem to your Gemfile.

Sign up to request clarification or add additional context in comments.

Comments

1

Posting the answer you arrived at here so others will know:

With Rails 3.1, you no longer need to manually include the rails.js file in your application (or the jquery.js file for that matter). Having gem 'jquery-rails' in your Gemfile will already include these for you.

When you do manually include old pre-Rails 3.1 versions of these files, it could interfere with proper javascript/jQuery functionality.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.