Session, Request, Params Ada Di Model. OK or Break the MVC Concept

2012-10-19 09:45:00 +0700 MVC, rails, ruby
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class ApplicationController < ActionController::Base
  around_filter :_controller_for_model

  ....

  protected
  def _controller_for_model
    accessor = instance_variable_get(:@_request)
    kelasess = [ActiveRecord::Base, ActiveRecord::Base.class]

    kelasess.each do |kelas|
      kelas.send(:define_method, "controller", proc {accessor})
    end
    yield
    kelasess.each do |kelas|
      kelas.send :remove_method, "controller"
    end

  end
end
Read on →

First Post

2012-10-19 09:37:00 +0700 Uncategories

Hollaaa …