My problem is that I want to test the edit form, so I always have this exception ..
You can help me figure out the problem
This error message is:
Undefined method `MODEL_NAME for NilClass': Excluded source (line 5 #): 2: & lt; Div class = "row" & gt; 3: & lt; Div class = "box" & gt; 4: & lt; Span id = "logo" & gt; Azubiware 2.0 & lt; / Span & gt; & Lt; Br> & Lt; Br> 5: & lt;% = form_for (@bsinfo) do | F | & Gt%; 6: & lt;% @basedate = Date.new (@bsinfo.year)%> 7: & lt;% @basedate = @ baseate.beginning_of_year% & gt; 8: & lt;% @basedate = @ basisate.beginning_of_week% & gt; I have a similar form that is going with my user table and it works properly ...
class BsinfosController & lt ; ApplicationController def index @title = "Verwaltung Abwesehnheiten" def new @title end = "sign up" @bsinfo = Bsinfo.new def = Bsinfo.find @bsinfo show end (parameter [: id]) @title = @ end bsinfo. Year Def @bsinfo = Bsinfo.new (params [: bsinfo]) @ bsinfo.save flash [: success] = "created to make the schedule successful" redirect_to bsinfos_path and other 'new' edit end-end def @title = " Settings "Update DEF Update @ bsinfo.update_attributes (params [: bsinfo]) Flash [: success] =" Profile Successfully Updated "redirect_to @bsinfo else render 'edit' end DF Bsinfo.find (params [: id]) deleted flash [: success] = redirect_to bsinfos_path end end "delete schedule" and edit link for link The way is
<% @bs = Bsinfo. All% & gt; & Lt;% @ bs.each do | Bsall | & Gt%; & Lt;% = link_to "# {bsall.name}", edit_bsinfo_path (bsall) ,: class = & gt; "Btn"%> & Lt;% end% & gt; The URL looks like a local host: 3000 / bsinfos / 17 / edit
Whatever model is based on your form is being returned as zero. Make sure that the @Worwer in the controller is based on the form actually set to the instance of the object you want.
Comments
Post a Comment