Search code examples
ruby-on-railsrubyruby-on-rails-3vanity-url

Vanities Gem Form Error


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?


Solution

  • 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.