Created
September 4, 2012 20:32
-
-
Save whito/3626125 to your computer and use it in GitHub Desktop.
Routing Problem in RailwayJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rw routes | |
users GET /users.:format? users#index | |
users POST /users.:format? users#create | |
new_user GET /users/new.:format? users#new | |
edit_user GET /users/:id/edit.:format? users#edit | |
user DELETE /users/:id.:format? users#destroy | |
user PUT /users/:id.:format? users#update | |
user GET /users/:id.:format? users#show | |
login GET /login users#login | |
login POST /login users#authenticate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title><%= title %></title> | |
<%- stylesheet_link_tag( 'style') %> | |
</head> | |
<body> | |
<form action='/login' method='post' id='login'> | |
<img src='images/logo.png'> | |
<fieldset> | |
<label>Username</label> | |
<input type='text' name='login' id='username' required autofocus> | |
<label>Password</label> | |
<input type='password' name='password' id='password'> | |
</fieldset> | |
<fieldset> | |
<input type='submit' class='button' value='Login'> | |
</fieldset> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.routes = function (map) { | |
map.resources('users'); | |
//custom routes here | |
map.get('login', 'users#login'); | |
map.post('login', 'users#authenticate'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//users_controller.js (omitted out the CRUD actions) | |
action(function login() { | |
console.log("in login-------"); | |
layout("login"); | |
this.title= "Login Page"; | |
render(); | |
}); | |
action(function authenticate() { | |
// this never shows up when the form is posted. | |
console.log("in authenticate"); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you please show your config/environment.js