سؤال

I have the following code as a controller action:

def create
  render :js => "alert('hello')"
end

But when I go to this view, I get a missing template error – 'create.rhtml'. What is the correct way to render a javascript response in Rails 1.2.6?

هل كانت مفيدة؟

المحلول

render :file is probably your best bet with Rails that old. You can also use the old RJS style.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top