File Uploding coding problems

class Post < ActiveRecord::Base
   f ="pictures/#{person['name']}/picture.jpg", "wb")
   f.write params[:picture].read

in the uploading it gives a error like this

undefined local variable or method `params' for Post:Class

The message is pretty clear: params doesn't exist here. It only exists inside an instance of controller. You need to pass params through to the save method (which you're already doing, but not using it for some reason.).