Rails 3 multi-step form with intermediate calculations not param or stored -


models procedure , option have habtm relationship
model quote builds prices on basis of parameters first 2 tables in multi-step form.

step 1 queries procedure , helper file (or module) extracts relevant data.

def quote_procedure   procedure = procedure.where(['id = ?',params[:quote][:procedure_id]]).first end 

and various calculations run, identifying related options. @ point, want run calculations for_each related option. however, not parametrised , not stored values of table quote. no @, no params ...

i have not found proper syntax process relevant data options table. helper (eventually module, i'll have execute calculations):

def quote_option   option = option.where(['id = ?', self.id]) end  def my_calculation   (quote_option.sum_operational_costs / quote_option.procedure_speed) * params[:quote][:quantity] end 

however, if in controller

  @options = option.where(['procedures_options.procedure_id = ? , option_type_id = ?',     params[:quote][:procedure_id], 1]).joins(:procedures) 

i generate result in view helper methods (all last one)

<%= (global.speed_setup_intercept + (globale.speed_setup_factor * surface)) * options.print_speed %> 

but cannot manage through helper method. offending proposition

options.print_speed

and generates undefined method error


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -