rails simple form not getting created -
i new rails , have created simple example form me how not getting submitted below components:
this controller: class profilescontroller < applicationcontroller def new logger.info "from new" @profile = profile.new logger.info "after new" end def show end def list @profile = profile.find(:all) end def create logger.info "from create" @profile = profile.new(user_basic_params) if @profile.save redirect_to '/show' else render 'show' logger.info "save failed" flash[:notice] = "didn't work" end end def index end def user_basic_params logger.info "from user_basic_params" params.require(:profile).permit(:email, :password, :file, :active, :sex, choises: []) end end this view:
<div class="container center-block"> <div class="row"> <form class="form-horizontal"> <div class="form-group"> <h3> create new profile </h3> </div> <%= simple_form_for (@profile) |f| %> <div class="form-group"> <%= f.input :milk_animal, as: :radio_buttons, collection: ['cow','any'], placeholder: 'enter milk animal' %> </div> <div class="form-group"> <%= f.input :milk_type, as: :radio_buttons, collection: ['toned','any'], placeholder: 'milk type' %> </div> <div class="form-group"> <%= f.input :brand, placeholder: 'brand' %> </div> <div class="form-group"> <%= f.label :time_of_delivery %> <%= f.time_select :time_of_delivery, placeholder: 'time of delivery' %> </div> <div class="form-group"> <%= f.label :start_date %> <%= f.date_select :start_date, placeholder: 'start date' %> </div> <div class="form-group"> <%= f.input :delivery_days, as: :check_boxes, collection: [ 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satusday', 'all'], wrapper: :vertical_radio_and_checkboxes %> </div> <div class="form-group"> <%= f.input :name, placeholder: 'name' %> </div> <div class="form-group"> <%= f.input :address, as: :text, placeholder: 'address' %> </div> <div class="form-group"> <%= f.input :pincode, placeholder: 'pincode' %> </div> <div class="form-group"> <%= f.input :contact_no, placeholder: 'contact no' %> </div> <%= f.button :submit %> <% end %> </form> </div> </div> my model name profile , controller name profiles in route.rb file written:resources :profiles
when html source generated in browser form rendered in way :
<form novalidate="novalidate" class="simple_form new_profile" id="new_profile" action="/profiles/create" accept-charset="utf-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="authenticity_token" value="+qcqmhibaskk/qiu5vy66uy9xhlzr8tkpwaufzkm+q5swau6zy6qqlhfzygsguls+xu8ghx+c+ahjpro2u6bwg==" /> its seems looking @ action go create method, not.
and console output :
started "/profiles/new" 127.0.0.1 @ 2015-05-31 00:49:48 +0530 processing profilescontroller#new html new after new rendered profiles/new.html.erb within layouts/application (142.4ms) completed 200 ok in 178ms (views: 166.7ms | activerecord: 0.7ms) started "/profiles/new?utf8=%e2%9c processing profilescontroller#new html parameters: "brand"=>"amul", "commit"=>"create profile"} new after new rendered profiles/new.html.erb within layouts/application (158.2ms) have deleted few parameter in output
Comments
Post a Comment