ruby on rails - Rails4 Strong parameters without database column -


I have problems with public assignment and strong parameters In my model I have many properties, which in my mysql database Are displayed through a column. I have a field too, it is not so. I need this to calculate the price I do not want to store it in my database.

I have defined strong parameters in my controller:

  def timeslots_params params.require (: timeslot) .permit (: Employee_id ,: dienstplan_id ,: start_date ,: Start_time)  

But when I'm trying to use the start_time feature in my controller, I

  Start_time for #define method # Times: Lot 0x007fff2d5d8070> Error.  

There are other defined parameters with DB columns and filled with values. Do not I remember the strong parameters and I have to define something else?

Edit: Here's the code, where I call Times Lightsparam:

  def create @e = Timeslot New (Times Lotus_Peram) @ E. Start_date = @E Start_date To_s + "" + @ e. Start_time TOS If @ e.save current_user.timeslots & lt; & Lt; Do not reply @ E. Format | Format.json {Render: Jason = & gt; @E} End And End  
"post-text" itemprop = "text">

Please only allow the parameter, which you expect to send to your user if with data Start_time does not have user data to update your db, so use it like this:

  parameter.way ... (.  

if you use : Start_time, it should be defined in your model.

P> Oops, I have seen your update:

  @ e.start_date = @ e. Start_date.to_s + "+ @ e.start_time.to_s  

If you send: start_time to start with TimesSlot example, then start_time should be a method of Times Lot Model defined by rail.If it is DB area, defined with attr_accesor or att_reader Or your source model is defined by def key.

If not @ e.start_time triggers undefined method 'start_time' .

Re-edited:

Now, start_time is a model variable. Make sure that the form is sent in the same way that you do with the field. By default, we have an F and lt;% = f.text_field: the_field% & gt; . Just do not forget F.

If you follow my first advice then you will have to give permission for this area again.


Comments

Popular posts from this blog

Active Directory Authenticated Proxy Server with Squid or CNTLM -

java - Can't add JTree to JPanel of a JInternalFrame -

c - The joining operator ";" in my shell isn't working properly -