redirect_to in action destroy ruby on rails

redirect_to in action destroy ruby on rails

By : user2955852
Date : November 22 2020, 10:48 AM
hope this fix your issue I have the following resources in db/config , Use
code :
redirect_to post_comments_path(@post)
       Prefix Verb    URI Pattern                                                                       Controller#Action
post_comments GET     /posts/:post_id/comments(.:format)                                                comments#index

Share : facebook icon twitter icon
a Redirect_to from Destroy action always gets DELETE verb whatever :method I declare

a Redirect_to from Destroy action always gets DELETE verb whatever :method I declare

By : Joao Ochoa
Date : March 29 2020, 07:55 AM
will help you I have the following method in a controller named tareas_controller , Solved though not in a nice way..
created the following route:
code :
match 'mostrar_cliente/:id' => 'clientes#show', :via => :delete 
redirect_to "/mostrar_cliente/#{@tarea.cliente}", :format => :js
Ruby on Rails - CanCan user is nil during destroy action

Ruby on Rails - CanCan user is nil during destroy action

By : LightTrepidation
Date : March 29 2020, 07:55 AM
This might help you self answer warning! So, I guess delete actions need to happen within a form post in order for the identity and CSRF stuff to be handled correctly?!?
Replacing my link with a form made things work again:
code :
<%= form_for @project, :method => :delete do  %>   
  <%= submit_tag "Purge this project", confirm: "Are you sure you want to permanently remove this project?" %> 
<% end %>
Redirect_to from destroy not working in rails 4

Redirect_to from destroy not working in rails 4

By : Chris Farrow
Date : March 29 2020, 07:55 AM
I wish this helpful for you The source of your error is set_cart method. I guess you should remove:
code :
  respond_to do |format|
    format.html # show.html.erb
    format.json {render json: @cart}
redirect_to action in Create issue Ruby on Rails

redirect_to action in Create issue Ruby on Rails

By : Diego
Date : March 29 2020, 07:55 AM
Does that help If you are using Rails 4 and above, you shouldn't be using attr_accessor for attributes that are persisted in the database. This could be causing those attributes to not be saved properly.
Try removing your attr_accessor lines of code and rely instead on strong parameters:
code :
def project_params
  params.require(:project).permit(:name, :deadline, :description)
def create
    @project = Project.new(project_params)
    if @project.save
      redirect_to projects_show_path, notice: 'Project successfully added'
      flash[:alert] = 'An error ocurred adding your project. Please try again later'
      render 'new'
<% if @project.errors.any? %>
    <% @project.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
<% end %>
Ruby on Rails - Difference between redirect_to 'index' and redirect_to objects_path & redirect_to action: 'index'

Ruby on Rails - Difference between redirect_to 'index' and redirect_to objects_path & redirect_to action: 'index'

By : Gomathi Mohan
Date : March 29 2020, 07:55 AM
I hope this helps you . Short answer
It is recommend in most cases to use the named route helpers. In your case, the correct thing to do is redirect_to kiwis_path.
code :
~/projects/gitlab $ curl -v -H "Accept: text/html" http://localhost:3000/redirect_test
> GET /select_options HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: text/html
< HTTP/1.1 302 Moved Temporarily
< X-Frame-Options: ALLOWALL
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Location: http://localhost:3000index      <----- That is not what we want!
Related Posts Related Posts :
  • Why "bundle install" try to install outdated version of gems?
  • Rails - Customize model validation error messages but without a database
  • When to switch from cucumber to rspec in the BDD cycle for a login procedure
  • Multipart response for web service
  • How to hide Add new option in Rails Admin
  • Override CollectionProxy find method
  • Rails 4 simple_form has_many through check boxes not saving
  • ruby on rails authentication using devise gem
  • Rails iteration over arrays and hashes
  • Creating inline date_select dropdowns using simple_form and zurb foundation
  • NameError in SongsController#index uninitialized constant Song::FriendlyId
  • Rails how to improve if record exists?
  • omniauth custom request phase form
  • Rails 5 - Saving the absolute current url via a button to a cookie?
  • How can / should I override the `build` method for a my model?
  • Install Rails Failed on OSX 10.8.4
  • ruby on rails - undefined method valid?
  • Users Registration on POST
  • Rails application variables in carrierwave store_dir
  • How to customize simple_form for json nested hash
  • Couldn't find file 'jquery', Sprockets::FileNotFound in StaticPages#home error
  • How should I use the alias_method_chain for the build method?
  • how to create two custom registration forms in devise?
  • Rails 4 link_to Destroy not working in Getting Started tutorial
  • How does ruby on rails dynamically define `find_by_id`, `find_by_name` methods?
  • JBuilder dynamic keys for model attributes
  • `initialize': No such file or directory - getaddrinfo (Errno::ENOENT) when Rails new app
  • What is the Ruby equivalent of Node.js' socket.io?
  • Where rails store standard helpers?
  • how to check expected result matches any of give values in rspec?
  • Form submission to create multiple objects
  • Simple Twitter Login with Rails and Email confirmation
  • Where should helpful functions for my controller go in Rails?
  • Using session variable in the Model or the other way
  • Why can't I have ruby code and comments in Embedded Ruby?
  • Rails: How can I make an object available in all views?
  • Cannot enter simply form information into SQLite DB (Rails)
  • Rails - Retain form values on failed submission. Getting "First argument in form cannot contain nil or be empty&quo
  • How to handle STI and build related models automatically?
  • Suppress an error when saving a record in Rails
  • Rails AJAX reload the page. Why?
  • How to pass user attributes to action mailer
  • Custom Validator to Prevent an appointment from being scheduled too early in day?
  • Postgres Enable TCP/IP Connection
  • How do I avoid the circular argument reference warning in activesupport
  • Unable to push to heroku master because of rails/spring version error
  • deep nested routes in rails
  • Best approach to Users Profile Images in Rails App
  • RailsInstaller: Can I maintain the gem fold when re-installing a new version?
  • couldn't find file 'jquery-ui' i get this error even after having this file in my application.js
  • Ruby regex to split user and date text input
  • Tool like BetterErrors for JRuby?
  • Where are the I18n.t link and reference paths?
  • Sending emails to multiple recipients in rails app
  • Rails, Devise, Sign up = write name in other Database
  • pass custom attribute on rspec factory_girl controller test
  • rails generate uses wrong version of Ruby
  • Duplicate Requests from a Browser
  • One action in Rails controller sends no data back
  • Local data (JSON) in Middleman inside a different path than /data
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org