Reuse object in model in Rails
Remove the callback, and call that code at the level where it's used best.

I.e.:

When you create a batch of records:

#find and cache user
user = UserSession.find.user
# create your 100 records however you want... this is a dumb example
100.times { Post.create!(user: user) }


When you're in a controller, you want to do the same thing, except you're just creating one post.

user = UserSession.find.user
Post.create!(user:user, some:other, params:go_here)


Now that I've written it, it appears if you wanted to DRY up this example, you could wrap it in some class like this:

class CreatesPosts
  def self.create(num_records = 1, user = UserSession.find.user)
    num_records.times { Post.create!(user:user) }
    # might need to tweak to vary up the Post attributes
  end
end