Search code examples
ruby-on-rails-3ruby-on-rails-3.1

How to pass value from controller to model in ROR3.0?


i m new to ROR3.0 controller code

def create
   @data = Checking.check(arg1,arg2,arg3,agr4)
end

model code

def self.check
   @vl1=arg1
   @vl2=arg2
   @vl3=arg3
   @vl4=arg4
end

how to pass value from controller to model


Solution

  • Declare the arguments list for the model class method.

    def self.check(arg1,arg2,arg3,agr4)
       @vl1=arg1
       @vl2=arg2
       @vl3=arg3
       @vl4=arg4
    end