Setting currency with form select with Money gem

前端 未结 1 1646
心在旅途
心在旅途 2020-12-30 15:29

I have been working quite a few hours on this one but I can\'t figure out this one.

I am willing to have the user select a corresponding currency for the price he i

相关标签:
1条回答
  • 2020-12-30 15:44

    SOLVED!!

    Solved by adding one line in create method :

    def create
        @power_plant_substrate = PowerPlantSubstrate.new(params[:power_plant_substrate])
    
        # here I am setting the currency with what was sent in params
        @power_plant_substrate.currency = params[:power_plant_substrate][:currency] <=== this line
    
    ...
    
    end
    
    0 讨论(0)
提交回复
热议问题