Rails Form Renders Twice -
sometimes when submit form , go in browser renders entire form twice (see screenshot).. not sure if view or controller code causing cant seem figure out.
thanks
occasions_controller.rb
def create @user = current_user @occasion = occasion.new(params[:occasion]) @occasion.user = user.find(current_user.id) if @occasion.save redirect_to occasions_path else render :new end end
user_steps/occasions.html.erb
<%= simple_form_for @user, url: wizard_path |f| %> <div id="single_module"> <div class="pitch"> <h2 class="signup">step 3: first occasion!</h2> </div> <div id="input1" style="margin-bottom:4px;" class="clonedinput"> <p>*just 1 started, after completion of sign process have chance utilize our occasion wizard add many events like! (exciting, know)</p> <ul class="testss1"> <%= f.simple_fields_for :occasions |occasion_o| %> <li><%= occasion_o.input :name, :placeholder => 'enter occasion name', :hint => ('examples: anniversaries, birthdays, graduations, mothers day, fathers day, valentines day, weddings, holidays') %></li> <li><%= occasion_o.input :pname, :label => 'persons name', :placeholder => '(optional)' %></li> <li><%= occasion_o.input :dateg, :label => 'date',:as => :date_picker, :input_html => { :class => 'special' } %></li> <li><%= occasion_o.input :recurring, :as => :radio_buttons, :label => 'remind me of event every year?' %></li> <h3>top 3 interests</h3> <li class="tes1"><%= occasion_o.association :interests, :label => false, :as => :check_boxes %></li></ul> <%end%> </br> </div> <%= link_to "skip step", next_wizard_path %> <%= f.button :submit, 'submit' %> </br> </br> </br>
it looks user has 2 occasions tied it. check length of occasions puts statement in controller , check log:
def create @user = current_user puts "the current length of occasions #{ @user.occasions.length }" @occasion = occasion.new(params[:occasion]) @occasion.user = user.find(current_user.id) if @occasion.save redirect_to occasions_path else render :new end end
Comments
Post a Comment