0
votes

So i have this 2-step Twitter Sign in and at the page where the user must enter his Email i get an undefined method error.

My Form :

<%= simple_form_for(@user, :as => "user", :url => account_create_path, :html => {:class => "form-inline"}) do |f| %>
  <%= f.input :email, :placeholder => User.human_attribute_name(:email), :class => "input-medium" %>
  <%= f.submit "Finish registration", :class => "btn btn-small" %>
<% end %>

I think that it's a Syntax problem, but as i am fairly new to Rails i cant figure out what is wrong. Google wont tell me either :)

my Accounts_controller.rb:

def create
        data = session["devise.omniauth_data"]
        data[:email] = params[:user][:email]
        user = User.find_for_twitter_oauth(data)
        user.email = data[:email]

        if user.save
            flash[:notice] = I18n.t "devise.registrations.signed_up_but_unconfirmed"
            redirect_to root_path
        else
            flash[:error] = I18n.t "devise.omniauth_callbacks.failure",
                                                         :kind => data[:provider].titleize,
                                                         :reason => user.errors.full_messages.first
            render "users/omniauth_callbacks/add_email"
        end
    end

enter image description here

1

1 Answers

1
votes

Change variable user to instance variable @user in controller and problem will be fixed.