开发者

Is the Rails console running as a Controller?

开发者 https://www.devze.com 2023-01-23 14:09 出处:网络
It seems like Rails\' console (script/console or rails console) is like in a controller, but self.class开发者_运维百科 gives Object (Rails 3.0.1 with Ruby 1.9.2), so is it controller or none of M, V,

It seems like Rails' console (script/console or rails console) is like in a controller, but self.class开发者_运维百科 gives Object (Rails 3.0.1 with Ruby 1.9.2), so is it controller or none of M, V, or C?


It's nothing - as it's not part of your production stack, but just a tool that sets up a useful debugging environment for you.

And it's certainly not a part of your application, so it doesn't fit into the whole MVC model.


https://github.com/rails/rails/blob/3-0-1-security/railties/lib/rails/commands/console.rb

You can see it basically just parses command-line options and then starts an IRB session. Helper methods like "reload!" are defined here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号