ruby on rails - Missing template in RoR application -


in ruby on rails application, want controls value controllers page:

    below view page: <%= form_for :managerviewresume, :url => { :method => :post, :action => :managerviewresume }) |f| %>         <table class="table" width="100%">             <tr>                 <td><%= @selection %></td> //here checking radio button value                 <td>                     <label style="font-size:small;">selected?</label>                     <label class="radio inline" style="font-size: small">                     </br>&nbsp;&nbsp;&nbsp;                     <%= f.radio_button :select, "yes", :id => "rb_select1" %>                     yes                     </label>&nbsp;&nbsp;                     <label class="radio inline" style="font-size: small">                     <%= f.radio_button :select, "no", :id => "rb_select2" %>                     no                     </label>                 </td>             </tr>             <tr>                 <td>                     <%= f.submit "save", { :class => "stylbutton" } %>                 </td>             </tr>         </table>      <% end %> 

below controllers page:

class managerscontroller < applicationcontroller   def managerviewresume     @selection = params[:select]     render "managerviewresumes"   end end 

in controller's page getting below error @ line render 'managerviewresumes' :

missing template managers/managerviewresumes, application/managerviewresumes {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. searched in: * "c:/sites/videoresume/app/views"  

below route:

  match '/managerviewresumes',  to: 'managers#managerviewresume', via: 'get' 

kindly suggest should radio button value view page controller page. waiting reply. thanks.

render

firstly, don't need use render render same view action name

when using rails controller, can call without issue:

#app/controllers/your_controller.rb class yourcontroller < applicationcontroller    def your_action        #-> automatically render "your_action" view    end end 

so remove reference render action (as unnecessary step). not resolve issue directly, should ensure application more convention on configuration

--

routes

secondly, may need @ resourceful routing

in rails' routing structure, able call resources :controller generate series of restful routes:

enter image description here

i understand want keep using action, sake of correctness, can recommend config/routes.rb file & ensure you're using many resource-based routes possible:

#config/routes.rb resources :managers    collection        post :managerviewresume    end  end 

--

form

finally, think form needs improved

you're using form_for, activerecord objects (if want create new record etc. seems you'll better suited using form_tag instead:

<%= form_tag managers_managerviewresume_path %>     <table class="table" width="100%">         <tr>             <td><%= @selection %></td> //here checking radio button value             <td>                 <label style="font-size:small;">selected?</label>                 <label class="radio inline" style="font-size: small">                 </br>&nbsp;&nbsp;&nbsp;                 <%= radio_button_tag :select, "yes", :id => "rb_select1" %>                 yes                 </label>&nbsp;&nbsp;                 <label class="radio inline" style="font-size: small">                 <%= radio_button_tag :select, "no", :id => "rb_select2" %>                 no                 </label>             </td>         </tr>         <tr>             <td>                 <%= submit_tag "save", { :class => "stylbutton" } %>             </td>         </tr>     </table>  <% end %> 

this syntax might need checking, send :select params required, not current form doing.

this should coupled views/managers/managerviewresume.html.erb file rails load


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -