I have a database table ''tankticket'' that has the following fields: id tank_id ticket_date batchid product api tank_temp gauge gross_vol vol_correction roof_correction net_vol ticket_vol created_on updated_on I Have a form that requires ''tank_id'', ''ticket_date'', ''batchid'', ''product'', ''api'', ''tank_temp'', and ''gauge'' I''m calculating the rest of the data in the application helper. I need to know where the calculations should be triggered and how to get the input data and the calculated data to the database when the ''create'' button is clicked...! Thanks in advance...! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
crashbangboom wrote:> I have a database table ''tankticket'' that has the following fields:First thing I notice is that you''re not following the Rails default naming conventions. If you have a class TankTicket the table name should be tank_tickets> I Have a form that requires ''tank_id'', ''ticket_date'', ''batchid'', > ''product'', ''api'', ''tank_temp'', and ''gauge'' > > I''m calculating the rest of the data in the application helper. I need > to know where the calculations should be triggered and how to get the > input data and the calculated data to the database when the ''create'' > button is clicked...!The application helper lives in the View layer of Model-View-Controller (MVC). Data calculation belong in the Model layer. View layer helpers like the application helper can be used for formatting of data for display to the user, but should not directly calculate data that need to be persisted into a data store. Read up on ActiveRecord callbacks for information about where and when to "trigger" your calculations. But, the first thing you need to do is get your calculations out of the View helper and into the Model layer. That might be the TankTicket class in your case, but I don''t have enough information to know that for sure. http://railsapi.com/doc/rails-v2.3.8/classes/ActiveRecord/Callbacks.html -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yeah...my bad...the table name is ''tanktickets'' and does follow rails naming conventions...!...So far, the entire application is running fine for all the simple things...now it''s on to the more complicated with the text in this help request...! Thanks for the advice...I''m reading up on what you suggested now...! On Jul 30, 12:05 pm, Robert Walker <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> crashbangboom wrote: > > I have a database table ''tankticket'' that has the following fields: > > First thing I notice is that you''re not following the Rails default > naming conventions. If you have a class TankTicket the table name should > be tank_tickets > > > I Have a form that requires ''tank_id'', ''ticket_date'', ''batchid'', > > ''product'', ''api'', ''tank_temp'', and ''gauge'' > > > I''m calculating the rest of the data in the application helper. I need > > to know where the calculations should be triggered and how to get the > > input data and the calculated data to the database when the ''create'' > > button is clicked...! > > The application helper lives in the View layer of Model-View-Controller > (MVC). Data calculation belong in the Model layer. View layer helpers > like the application helper can be used for formatting of data for > display to the user, but should not directly calculate data that need to > be persisted into a data store. > > Read up on ActiveRecord callbacks for information about where and when > to "trigger" your calculations. But, the first thing you need to do is > get your calculations out of the View helper and into the Model layer. > That might be the TankTicket class in your case, but I don''t have enough > information to know that for sure. > > http://railsapi.com/doc/rails-v2.3.8/classes/ActiveRecord/Callbacks.html > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.