0

I am trying to add vanity url's to my app and I decided to use the vanities gem. The installation was very simple and everything has seemed to work well. I was able to create a vanity url and put it on a user through the console. When I tried to create a form field in my user create and user update to input a vanity url though it is not working. The following error is thrown.

Vanity(#2178512900) expected, got String(#2151988680)

I'm not sure what the problem could be.

My user controller looks like this

   def new
     @user  = User.new
     @title = "Sign up"
   end

and my form view looks like

 <div class="field">
   <%= f.label :full_name, "Full Name" %><br />
   <%= f.text_field :name, :class => "label" %>
 </div>
 <div class="field">
    <%= f.label :email, "Email (@student.shu.edu)" %><br /> 
    <%= f.text_field :email, :class => "label" %>
 </div>
 <div class="field">
   <%= f.label :password %><br />
   <%= f.password_field :password, :class => "label" %>
 </div>
 <div class="field">
   <%= f.label :password_confirmation, "Password Confirmation" %><br />
   <%= f.password_field :password_confirmation, :class => "label" %>
 </div>
 <div class="field">
   <%= f.label :vanity, "Vanity" %><br />
   <%= f.text_field :vanity, :class => "label" %>
 </div>

an ideas on what the issue could be or how I can create a form to submit my vanity url?

Michael Peralta
  • 293
  • 5
  • 18

2 Answers2

0

Based on that error it would seem that what ever method you are using to save the vanity URL is expecting an Object of type Vanity and you are passing in a String. Are you passing the string value directly from the form vanity text field into a method that isn't expecting a string?

Without being able to see your create and update actions, that's all the information I can provide. Hopefully it helps spark some "duh moments" :D

Cheers.

0

I actually contacted the developer for the app and he was able to clarify for me how the form works for the gem and also updated the github he posted with a sample app using the gem. Here is the link for the sample app, https://github.com/jaustinhughey/vtest , hopefully this is someone else who has this problem. Besides this misunderstanding the gem is great and very easy to use so I highly recommend it.

Michael Peralta
  • 293
  • 5
  • 18