0
votes

I'm losing my mind trying to figure this out:

There's a registration module which side-steps the main devise registrations controller, and I have to manually instantiate the Devise-generated user model using User.new(...). I'm using a form_tag to submit all of the necessary parameters necessary for User.new(). Here's a truncated version of my code:

def registration_three

  @user = User.new(:email => params[:email], :password => params[:password], :password_confirmation => params[:password_confirmation])
  @user.save

  @user = User.new(:email => '[email protected]', :password => 'qwertyui', :password_confirmation => 'qwertyui')
  @user.save

end

The second @user.save works, but the first one doesn't. params[:email], params[:password], and params[:password_confirmation] certainly exist, according to the print statements in stdout.

Anyone have any ideas?

EDIT: So I tried changing all of the single-quote strings in the second User.new(...) to double-quote strings like the ones stored in the params hash...and the second instantiation failed as well. So I'm fairly sure that the issue involves double- vs single-quote strings. Anyone know how to convert double-quote strings to single-quote ones? Thanks in advance.

1

1 Answers

0
votes

Store your params in variable first then use them in query to avoid quote errors