Skip to content Skip to sidebar Skip to footer

Twitter Bootstrap Modal Not Working In Rails

I am still fairly new Rails and to twitter bootstrap. I am working on a modal, but I receive a 'NoMethodError - undefined method 'render.'' When I remove the ('<%= escape_javas

Solution 1:

Just read that article and it says

Now we need some javascript to make this works, make a file named same way as the controller action but with the suffix .js.erb for this example should be:

Writer mentioned about name of file but forgot to tell you about the path of js file. Your js files path would be views/controller_name/new_release.js.erb and not assets/javascript/new_release.js.erb

If you look at your controller method

defnew_release
  respond_to do |format|
    format.html  #If it's a html request this line tell rails to look for new_release.html.erb in your views directoryformat.js #If it's a js request this line tell rails to look for new_release.js.erb in your views directory
  end
end

For details checkout Working with Javascript in Rails

Solution 2:

Change view file name from "_new_release.html.erb" to "new_release.html.erb" . I dont know why you are using underscore before file name .

if it is partial than use : ("<%= escape_javascript(render (partial:=>'project/new_release')) %>"

Post a Comment for "Twitter Bootstrap Modal Not Working In Rails"