DISQUS

Building Browsergames: Creating The Bank (Ruby on Rails)

  • Janus · 1 year ago
    Can't figure out this current_user
  • John · 1 year ago
    current_user is a function that was provided to us by the restful_authentication system. Whenever we call it, it uses the ID of the logged in user (if any) that is stored in the session to look up a user record and assign it to the variable @current_user.

    If you follow the instructions in The Login Page (Ruby on Rails) Part 2 (http://buildingbrowsergames.com/2008/08/25/the-...) you will be able to call this function from any of your controllers to pull the latest version of the user into a variable accessible from the controller and from the view that the controller will forward to.

    If my explanation didn't help or you have any more questions, please ask.
  • Customer Retention · 10 months ago
    Ruby on Rails is sweet but have you thought about using Simple Scripts? This is also good if not better.
  • Mattias · 9 months ago
    I get a Routing Error:
    No route matches "/bank" with {:method=>:get}

    I have quadruple checked letter by letter, and comparing differences with the other controllers. I can't find the problem :O
    Please help.
  • JohnMunsch · 9 months ago
    That doesn't sound like an error in your code, more like an error in the file naming. Did you name it "app/controllers/bank_controller.rb"? If not then it isn't able to find the controller with that name. Also it is expecting to find the views in "app/views/bank".

    It might help to download the current version of the code from here: http://code.google.com/p/building-browsergames-...

    That has everything I've done in it so far, including the bank. You could compare yours against that and perhaps find the problem. Failing that, please contact me at john.munsch@gmail.com.