Ruby on Rails Friday, February 13, 2015

On Friday, February 13, 2015 at 7:55:19 PM UTC, Jason Hobbs wrote:
> Add gem 'responders' to your Gemfile.
> redirect_to was moved to that.

It most certainly wasn't (responders gem is about respond_with/ class level respond_to)

Fred


>
> On Friday, February 13, 2015 at 10:02:04 AM UTC-6, Ruby-Forum.com User wrote:Trying to upgrade from Ruby 2.0 / Rails 4.0 to Ruby 2.2 / Rails 4.2, I
>
> face a surprising error when logging into my application (based on Rails
>
> Tutorial by M. Hartl):
>
>
>
> Controller: SessionsController#create
>
> Instruction: redirect_to root_url
>
> Error message: wrong number of arguments (2 for 1)
>
>
>
> Here is the sessions controller:
>
>
>
> class SessionsController < ApplicationController
>
>
>
>   def new
>
>   end
>
>
>
>   def create
>
>     user = User.find_by_login(params[:session][:login])
>
>     if user && user.authenticate(params[:session][:password])
>
>       sign_in user
>
>       redirect_to root_url
>
>     else
>
>       flash.now[:error] = 'Invalid login/password combination'
>
>       render 'new'
>
>     end
>
>   end
>
>
>
>   def destroy
>
>     sign_out
>
>     redirect_to root_url
>
>   end
>
>
>
> end
>
>
>
> Here is the routes file:
>
>
>
> ODQStairs::Application.routes.draw do
>
>
>
>   resources :requests
>
>
>
> #static pages
>
>   get '/help',      to: "static_pages#help"
>
>   get '/about',     to: "static_pages#about"
>
>   get '/contact',   to: "static_pages#contact"
>
>
>
> #root definition
>
>   root to: "dashboards#home"
>
>
>
> #routes
>
>   resources :sessions, only: [:new, :create, :destroy]
>
>   get '/signin',  to: 'sessions#new'    , via: :get
>
>   match '/signout', to: 'sessions#destroy', via: :delete
>
>
>
>   resources :parameters_lists do
>
>       resources :parameters
>
>   end
>
>   ...
>
>
>
> I did not find anything in Rails upgrade guides regarding the
>
> redirect_to function. Your help is welcome! Thanks!
>
>
>
> --
>
> Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9be0d6a9-6730-4cac-8fe8-25c46ab0b5c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment